-
Notifications
You must be signed in to change notification settings - Fork 0
Tests
This page gives an overview of our testing system.
Our continuous integration server can be found at: http://ci.unknown-horizons.org
Before you can run the tests, the following python modules have to be installed:
We're using nose
as test runner, but you have to use the run_tests.py
script instead of nosetests
that comes with nose. However run_tests.py exposes the same command line interface as nosetests, therefore both commands should behave the same.
python run_tests.py
This command will run all tests in the tests/
directory.
To run only specific tests, you may either pass a directory path or a python package path.
python run_tests.py tests/unittests/ # run every test in this directory (including sub-directories)
python run_tests.py tests.unittests.world # run every test in this package/module
python run_tests.py tests.unittests.world.test_storage:TestGenericStorage # run a specific test case
python run_tests.py tests/unittests/world/test_storage.py:TestGenericStorage.test_alter # run a specific test in the test case
For more information, check out the documentation on nose
.
Sometimes failing tests produce a lot of output to the console which makes relevant information harder to read. In order to hide it, run tests with additional parameters.
Hide logging:
python run_tests.py --nologcapture
Disable printing:
python run_tests.py -s > /dev/null
Running both, e.g.
python run_tests.py --nologcapture -s > /dev/null
Should leave you only with relevant unit test output.
TODO: Add explanation how to write one
AI tests take longer to run, therefore by default they will not run. They are tagged with the attribute 'long', using -a long
will include them in the test discovery:
python run_tests.py -a long
TODO: Add explanation how to write one
GUI tests work differently than unit/ai tests. For each test, a new game will be started and the test interacts with the game. This takes some time, therefore they are disabled by default.
python run_tests.py -a gui
How to write: Writing GUI tests