google / googletest

GoogleTest - Google Testing and Mocking Framework
https://google.github.io/googletest/
BSD 3-Clause "New" or "Revised" License
33.79k stars 10k forks source link

Add public interface for XmlUnitTestResultPrinter #4402

Open LittleFox94 opened 8 months ago

LittleFox94 commented 8 months ago

Allowing custom gtest_main implementations to instantiate the XmlUnitTestResultPrinter with either a given file path or any other kind of std::ostream to write to.

This is useful for e.g. embedded cases where an XML report is still wanted, but not file system is available, by instantiating with a std::stringstream and delivering the data via any custom mean.

Related to #1930

This clearly needs some more polishing (e.g. docs in the header), but before I'll do the chores, I'd like some feedback :)

google-cla[bot] commented 8 months ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

LittleFox94 commented 8 months ago

For some context, this is an example how that might be used: https://praios.lf-net.org/littlefox/lf-os_amd64/-/blame/d499372dc4d35ddc468027955006f4af3edcebe8/src/runtime-tests/gtest_main.cxx#L19-21

(this is not merged to my main yet, so I hope that commit hash stays non-GC'd long enough to be useful ^^')

dinord commented 8 months ago

Making this a public interface generally sounds good to me.

LittleFox94 commented 7 months ago

Making this a public interface generally sounds good to me.

thank you for that feedback - sorry for getting back here this late, will look into tidying this up, hopefully soon :)