Development:Running Tests

Running the Tests Locally
To run the tests, navigate to the root directory of the OpenLP project, and then run the following command:

$ nosetests3 -v tests

Or, to run only the functional tests, run the following command:

$ nosetests3 -v tests/functional

Or, to run only a particular test suite within a file, run the following command:

$ nosetests3 -v tests/functional/test_applocation.py

Finally, to only run a particular test, run the following command:

$ nosetests3 -v tests/functional/test_applocation.py:TestAppLocation.get_frozen_path_test

Logging into Jenkins
We use Jenkins for our Continuous Integration server. Jenkins checks out the code, runs all our tests automatically, and runs other code analysis tools like PEP8 on the code base. This gives us a set sane environment as a baseline for our tests.


 * 1) Go to our OpenLP Jenkins instance and create an account. Skip to step 3 if you've done this already.
 * 2) Once you've registered, contact Raoul (superfly in IRC) and give him your username. He will let you know once your account has the correct permissions set up.
 * 3) Log into Jenkins
 * 4) Click on the "Branch" tab
 * 5) Click on the play/time icon in the far right column of the first job in the list.
 * 6) Type in your branch on Launchpad's URL (lp:~username/openlp/branchname) and click "Build"
 * 7) Watch your branch being built
 * 8) If anything fails, you need to fix your code :-)

Running Jenkins Locally
Running the tests as described above is a little bit tedious, so we've written a script to make your life a little bit easier.

The script requires the jenkins-webapi module installed, so install this using pip or easy_install (bonus points for using virtualenv):

$ pip install jenkins-webapi

Once you've pushed your code up to Launchpad, simply run the  script, and it will detect your remote branch, kick off the tests, and present you with the results on the command line.

$ python3 scripts/jenkins_script.py

Copy the result output into the description box of your merge proposal to show the team that you've run the tests on Jenkins.