Skip to content
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

Write to stdout rather that a file on disk #15

Open
davidmatson opened this issue Jun 8, 2022 · 4 comments
Open

Write to stdout rather that a file on disk #15

davidmatson opened this issue Jun 8, 2022 · 4 comments

Comments

@davidmatson
Copy link

From a quick look through the implementation, it appears that it writes to files on disk rather than stdout. Is that understanding correct?

TAP expects output to be written to standard output:
http://testanything.org/tap-version-14-specification.html

(for example, the "Bail out!" section talks specifically about writing to standard output)

Does GoogleTest have an option for not writing its own output to standard output, so that the TAP listener could write there instead, per the TAP spec?

@davidmatson
Copy link
Author

It looks like there's no option to suppress GoogleTest using stdout:
https://google.github.io/googletest/faq.html#googletest-output-is-buried-in-a-whole-bunch-of-log-messages-what-do-i-do

But stderr is kept separate, which might help, though it's also used for LOG from tests.

@davidmatson
Copy link
Author

Actually, it looks like there is a way to do that:
https://chenchang.gitbooks.io/googletest_docs/content/googletest/AdvancedGuide.html

There's only one problem: the default test result printer is still in effect, so its output will mingle with the output from your minimalist printer. To suppress the default printer, just release it from the event listener list and delete it.

Can the TAP listener be updated to use this technique, so that results go to stdout per the TAP specification?

@kinow
Copy link
Owner

kinow commented Jun 8, 2022

Hi @davidmatson

Thanks for the issues. I think what you asked is doable. And in good timing with tap14 released recently.

Let's try to release a new version more compatible with tap14.

Feel free to send a PR if you have some spare time. It might take a while until I have time to work on it.

Cheers
Bruno

@Prikalel
Copy link

Prikalel commented Jan 3, 2023

Yeee boy.
You can use GTEST_TAP_PRINT_TO_STDOUT. Look at

#ifdef GTEST_TAP_PRINT_TO_STDOUT
.

Don't forget to put it before including:

#include "gtest/gtest.h"
#define GTEST_TAP_PRINT_TO_STDOUT 10
#include "tap.h"
//... your tests

And the binary will print to stdout! :-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants