rostest & Python - Multiple Test Fixtures In Single File
With integration testing and rostest with Python, is it possible to define multiple test fixtures (classes inheriting from unittest.TestCase
) and run them from a single file? Or do I need to create a new file for every test fixture I create?
I would like to have a single file which contains functional tests (tests which cover acceptable usage of code) and halt-catch-fire tests (tests which blatantly abuse code to evoke failure responses). Ideally the functional and HCF tests are classes which inherit from unittest.TestCase, and in turn these classes have multiple feature-specific tests.
However I am running into problems trying to run two integration tests from a single file. It's as if the first test's results are overwritten by the second test. Is this not the intended use of rostest? I.e. what I would like to do is have a file my_node_integration_tests.py
contain the following:
if __name__ == '__main__':
import rostest
rostest.rosrun('my_package', 'my_functional_test', FunctionalTestFixture, sys.argv)
rostest.rosrun('my_package', 'my_hcf_test', HcfTestFixture, sys.argv)
And my .test file contains:
<test test-name="my_node_test_suite" pkg="my_package" type="my_node_integration_tests.py" />