[openstack-dev] testr now Nova's test runner

Clark Boylan clark.boylan at gmail.com
Sat Dec 15 02:06:11 UTC 2012


Hello,

The change (https://review.openstack.org/15078) to make testr Nova's
test runner merged in the last hour or so. What does this mean?

* Nova's unittests will now be run in X parallel processes where X is
  the number of CPUs available on your machine (which results in much
  faster testing).
* Parallel testing means you cannot count on your tests being run in
  the same order each time they are run or in the same process. Tests
  should be independent units.
  * Make sure you subclass nova.test.TestCase for your test classes to
    pull in the proper base setUp and tearDown stuff.
  * Use fixtures.Fixture to build robust fixtures that properly set
    and reset state before and after each test.
* Virtual envs will need to be rebuilt as dependencies have changed.
* Each test run is logged in subunit under .testrepository/$TEST_RUN_NUMBER.
  * Every test run during the test run will be captured in this log.
  * For each test in this log you will find the captured stdout,
    stderr, and logging for when that test was run (this content is also
    echoed to stdout when a test fails).
* Running tests shouldn't change too much. tox -epy2X will still work
  and most of the run_tests.sh functionality was preserved.
  * For more info on running tests see http://wiki.openstack.org/testr.
* The logs provided by Jenkins will include the console log and an
  html page with test details (that does not change). You will also find
  the subunit log for that test run.

This is a semi large change and there are differences between nose and
testr, non python2.6 test facilities like setUpClass will no longer be
available under python2.6 for example. But most of these changes
should be positive. Tests run faster, each test comes with very
verbose logs, tests end up being more robust as testr shouldn't have
the zero tests run but pass anyways problem. Additionally, because
tests are run in different orders and in parallel, testr will often
catch things like missing imports or conflicts between test cases (in
fact most of the work involved in making this happen was in fixing
test bugs).

It would be great if other projects used
https://review.openstack.org/15078 as a template for switching over to
testr as well. Let me know if you have questions.

Thanks,
Clark



More information about the OpenStack-dev mailing list