Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate Google C++ Unit Test XML Report

I am new to using Google test framework for unit testing and am intending to generate an XML report of the tests or the command output as a report (I could just print it obviously). I have read up on Generate XML Report , but haven't been able to understand clearly on how to go about generating the report. Any help would be greatly appreciated.

Cheers.

like image 933
Neophile Avatar asked Nov 25 '11 11:11

Neophile


People also ask

How do I create a Gtest report?

Right click on project and go to properties. Go to Configuration Properties->Debugging. In Command Arguments add --gtest_output="xml:\home\user\XML_Report. xml"

Can I use Gtest for C?

GTest is objected oriented tool and C language isn't! from GTest website gmock_for_dummies.md so you will use only macros like expect_equal, expect_bigger_than and so on... I would like to suggest you tool CMocka (or some other C unit testing tools).

How do I add a Google test to Visual Studio project?

Add a Google Test project in Visual Studio 2022 In Solution Explorer, right-click on the solution node and choose Add > New Project. Set Language to C++ and type test in the search box. From the results list, choose Google Test Project. Give the test project a name and choose OK.


1 Answers

For Linux environments:

It's simple you just have to set the GTEST_OUTPUT environment variable like this: export GTEST_OUTPUT="xml:/home/user/src". or use the -gtest_output flag set the same way.

like image 186
v01d Avatar answered Sep 18 '22 17:09

v01d