ament / ament/ament_cmake

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

Abierto
#445 0 comentarios 0 reacciones 0 asignados Ver en GitHub
in review
Lenguaje dominante
CMake
Estrellas
125
Forks
147
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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).

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.