google / google/googletest

gtest should support output stream redirect

Open
#1,930 10 comments 1 reaction 1 assignee Claimed by @asoffer View on GitHub
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.