Combining the JUnit report.xml generated by running multiple GoogleTest executables #4568
Replies: 1 comment
-
Comments on the problemI am assuming that you are wanting to combine reports for reporting on integration test purposes. If you are wanting to do unit tests for each system separately, but combine the results of the unit tests, then I would not recommend that. I would recommend having unit tests write to their own reports to make it easier and faster for your pipeline to process results of each test individually. You can use a separately running reporting app to accumulate the results from the individual tests for an overall report. That way it can be executed as a standalone when you need to collect everything for a report. Description of my approachI'm not sure if this is helpful to you, but if I am not mistaken, this is going to change based on how you open the file and write to it. If you look through GTEST's source code, their reports are printed utilizing C's std::printf method. I assume the I wrote my own, but this was due to me not being aware of them even having this flag. My implementation follows the example in this Stack Overflow Solution. You are also able to take advantage of using I would have to dive into their usage of Example from StackOverflow printf postMy specs
ExampleHere is the code I am using in my unit tests currently. (Requires C++17 minimum, and I'm using C++23)
|
Beta Was this translation helpful? Give feedback.
-
Hello!
I am new to GoogleTest and I have a number of cpp files each with its own GoogleTest initializations and
RUN_ALL_TESTS()
in the main function. I can generate their executables using Make build and individually generate report.xml for each of the test executables.However, I need to merge the generated report.xmls into a single report.xml that I can visualize in CICD pipeline.
Contents of the main function:
How I am generating a single report.xml:
./test_xxx --gtest_output="xml:report.xml"
Beta Was this translation helpful? Give feedback.
All reactions