gtest-tap-listener
gtest-tap-listener copied to clipboard
Write to stdout rather that a file on disk
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?
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.
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?
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
Yeee boy.
You can use GTEST_TAP_PRINT_TO_STDOUT
. Look at https://github.com/kinow/gtest-tap-listener/blob/a6ea8958cd31cdf40d06e4afac4688d7202c0359/src/tap.h#L234.
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