Is it possible to make GoogleTest output an xml file by asking it to, in main() ?
I know I can change the system environment variables (does anybody actually do that ?), or use a command line argument
–gtest_output=”xml:_path_to_output_file_”.
What I would like to do is have my program automatically generate the xml, every time, using a file name based on the project name. And of course – it would not happen on my computer…
I looked in InitGoogleTest, but I can’t see anything I can touch.
(I would like to write actual code, not run my program in a postbuild).
Are there any options for this ?
You can simply assign
GTEST_FLAG(output) = "xml:_path_to_output_file_";. If you do that before invokingInitGoogleTest, it will act as a default. If you do that after invokingInitGoogleTest, it will override any--gtest_outputvalue you provide in the command line.