Using rostest with gtest value-parameterized tests
I have a test suite that implements Google's value-parameterized tests using a TEST_P
test type and INSTANTIATE_TEST_CASE_P
to define a series of tests.
When I run rostest
on my .test
file, only the tests defined with TEST_F
are run, not the parameterized ones. However, when I run rostest --text
with the same .test
file, all tests, including those defined with TEST_P
, are run.
What is causing the difference, and how can I cause the standard rostest
call to run all of my tests and record the results to the standard XML file?
EDIT: It turns out that in fact all of the tests are being run and recorded in the XML files. However, the results are not aggregated and output to the console unless --text
is specified. This is very bad, because even deliberately failing tests (with ASSERT_TRUE(false)
) does not cause make test
or rostest
to report failure. As a result, any number of tests would fail, and I would never know unless I manually checked the XML, which is counter to the entire point of gtest.
Is this expected behavior? Or a bug I should file?
EDIT 2: Apparently, I need more karma to attach a file, so I have uploaded a complete test package to my website instead (it's a complete package, in case I mangled some configuration to cause this error). Note that make test
returns success, as does rostest launch/sample.test
, while the XML file gets written correctly. Running the executable itself, with ./sampletest
, also correctly reports the failure. Additionally, I found that, if there are only TEST_P
cases in the test file, they get output to the console as expected.
I ran into a similar issue with the standard node-level-integration tests.
I'm seeing this same problems. I have an integration test, which have some regular TEST() tests and also some parametrized tests (declaring the class and then using TEST_P). The parametrized tests get ignored when running rostest. I don't see them in the rosunit xml either.