Search code examples
xmlunit-testinggoogletestcppunittest-reporting

GTest: Generate XML Reports for each Testsuite


GTest is creating a XML Report file, when the executeable is invoked with -gtest_output=xml:Name.xml. The XML File contains a summary of every testsuite. My question is, is it possible to create a XML Report for each testsuite?

Example of GTest XML Report

According to the picture, I want to have 6 different XML Reports for each testsuite. Is this possible?

In CppuTest, it is possible. It does this automatically.


Solution

  • I don't think there is a way to put them into separate files, however, you can at least create each file separately using gtest_output and gtest_filter.

    Once you created your tests's executable run it with the following parameters:

    <test_executable> --gtest_output=xml:name1.xml --gtest_filter=TestSuiteName1*
    <test_executable> --gtest_output=xml:name2.xml --gtest_filter=TestSuiteName2*
    <test_executable> --gtest_output=xml:name3.xml --gtest_filter=TestSuiteName3*
    ...
    

    You can easily write a script to generate these commands for your testsuites.