New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gtest should support output stream redirect #1930
Comments
Thank you very much for this report. The best way to approach this would be to create a proper PR and submit it for consideration. |
Before we even talk about a PR let's have a conversation about how this should be approached. There are many ways in which this can be done but all of them imply lots of changes to the existing code. Here are two that come immediately to mind.
I'm guessing I'm not the first one thinking about this and there might be already significant effort invested in the design of this feature. Let's discuss and agree on the best approach before spending lots of time to modify the code. |
I dont see anyone from the community chiming in here. At the same time this has not been a requirement internally. |
Lack of participation signals lack of interest from the community. Closing |
How many people from the community should vote for this issue to make you reopen it? |
So which approach should we take for this? See the two options I layed out above (or it can be a new one...) |
This would be a great feature in the embedded world! In many cases, we need to redirect the textual output to a variable and then return that content back to our desktop system in the near future. I second this. Any workaround at this point? |
Any progress on this? I am running on Android and don't see any output from my application so I currently expect this is my issue as from what I understand printf() goes to dev/nul |
@CraigHutchinson for Android, I have this PR that's been waiting for almost a year: #3864 For the printf case, I attempted a macro solution in 2018 which was closed because macros are evil: #1201 and I tried again with a |
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 google#1930
The default reporter (PrettyUnitTestResultPrinter) writes straight to stdout via printf calls. I would like to have an API so I can provide my own std::ostream, like boost Test library: https://www.boost.org/doc/libs/1_68_0/libs/test/doc/html/boost_test/test_output/logging_api/log_ct_output_stream_redirection.html
This is useful when you use gtest as part of a bigger framework and you need to redirect to output somewhere else (or convert it on the fly to a different encoding for example).
If for running the tests I can at least work around the problem by writing an event listener and writing into my own stream, for listing the tests, there is no workaround since
ListTestsMatchingFilter
is not accessible and the listeners are not invoked for the list tests action.The text was updated successfully, but these errors were encountered: