ament / ament/ament_cmake

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

Đang mở
#445 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
in review
Ngôn ngữ chính
CMake
Star
125
Fork
147
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.