Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ament_add_test default runner cannot handle Catch2 (or generalized) JUnit result files #445

Open
ngmor opened this issue May 10, 2023 · 0 comments
Labels
in review Waiting for review (Kanban column)

Comments

@ngmor
Copy link
Contributor

ngmor commented May 10, 2023

I was attempting to write ROS 2 C++ integration tests using Catch2 and running test nodes with a Python launch file. In order to report the results, I configured Catch2 to report results with JUnit XMLs.

Here is an example of an output of a failed test:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
  <testsuite name="integration_test_node" errors="0" failures="1" tests="1" hostname="tbd" time="0.082" timestamp="2023-05-10T17:38:18Z">
    <properties>
      <property name="random-seed" value="188745289"/>
    </properties>
    <testcase classname="integration_test_node.global" name="example_integration_test" time="0.082" status="run">
      <failure message="service_found" type="CHECK">
FAILED:
  CHECK( service_found )
with expansion:
  false
at /home/ngm/classes/final/compile/src/rosnu/test/integration_test_node.cpp:35
      </failure>
    </testcase>
    <system-out/>
    <system-err/>
  </testsuite>
</testsuites>

To run this test with colcon test, I was using ament_add_test() in my CMakeLists.txt. I noticed that failures were not being detected because in the runner script, where the result file is tested for failures, only the root tag of the XML tree is checked.

With further investigation, the JUnit XML format can often contain the root level <testsuites> tag that appears in the Catch2-produced file. Currently, this default runner cannot handle generalized JUnit files even though documentation states it requires a JUnit result file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in review Waiting for review (Kanban column)
Projects
None yet
Development

No branches or pull requests

2 participants