ament / ament/ament_cmake

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

Offen
#445 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
in review
Vorherrschende Sprache
CMake
Sterne
125
Forks
147
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

I was attempting to write ROS 2 C++ integration tests using [Catch2](https://github.com/catchorg/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](https://github.com/catchorg/Catch2/blob/devel/docs/reporters.md).

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







FAILED:
CHECK( service_found )
with expansion:
false
at /home/ngm/classes/final/compile/src/rosnu/test/integration_test_node.cpp:35




```

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](https://github.com/ament/ament_cmake/blob/rolling/ament_cmake_test/ament_cmake_test/__init__.py), where the result file is tested for failures, [only the root tag of the XML tree is checked](https://github.com/ament/ament_cmake/blob/154f1989578a30afe0b3613369681073470d16d9/ament_cmake_test/ament_cmake_test/__init__.py#L306).

With further investigation, the [JUnit XML format](https://github.com/testmoapp/junitxml) can often contain the root level `` 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](https://github.com/ament/ament_cmake/blob/154f1989578a30afe0b3613369681073470d16d9/ament_cmake_test/cmake/ament_add_test.cmake#L18).

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.