googletest icon indicating copy to clipboard operation
googletest copied to clipboard

Streaming output omits data included in XML/JSON

Open davidmatson opened this issue 2 years ago • 1 comments

Describe the bug

A number of data fields included in XML/JSON output are not available via streaming, making streaming output not usable for all output scenarios (such as a UI test runner that needs all result data).

Additional context

#3994 is the most important omission (and likely easy to fix).

Other data that is not available today when streaming results (but is included in XML/JSON results):

  • Disabled tests
  • UnitTest.random_seed
  • TestInfo.file
  • TestInfo.line
  • TestInfo.value_param
  • TestInfo.type_param
  • Test properties (including those for the UnitTest.ad_hoc_test_result, TestSuite.ad_hoc_test_result and TestResult)

Note: I've excluded timestamps/durations from the list above, since a streaming listener gets that data as it occurs (and can capture such timestamps/durations itself). I've also excluded counts of items reported individually (since a streaming listener can just count the items itself).

davidmatson avatar Sep 01 '22 19:09 davidmatson

Proposal:

Disabled tests: A new event type:

event=TestDisabled&name=SomeName

(probably also include file, line, type_param, and value_param, as with TestStart below)

UnitTest.random_seed: Add a parameter to the TestProgramStart event:

event=TestProgramStart&random_seed=123

TestInfo.file: Add a new parameter to TestStart:

event=TestStart&name=SomeName&file=path\to\some_file.cpp

TestInfo.line: Add a new parameter to TestStart:

event=TestStart&name=SomeName&file=path\to\some_file.cpp&line=123

TestInfo.value_param: Add a new parameter to TestStart (when present):

event=TestStart&name=SomeName&file=path\to\some_file.cpp&line=123&value_param=SomeValue

TestInfo.type_param: Add a new parameter to TestStart (when present):

event=TestStart&name=SomeName&file=path\to\some_file.cpp&line=123&type_param=SomeType

Test properties (a=b; foo=bar): UnitTest.ad_hoc_test_result: Add new parameters to TestProgramEnd:

event=TestProgramEnd&passed=0&property_a=b&property_foo=bar

TestSuite.ad_hoc_test_result: Add new parameters to TestCaseEnd:

event=TestCaseEnd&passed=0&elapsed_time=123ms&property_a=b&property_foo=bar

TestResult: Add new parameters to TestEnd:

event=TestEnd&passed=0&elapsed_time=123ms&property_a=b&property_foo=bar

(With this proposal, I'm guessing gtest_streaming_protocol_version=1.0 should be increased.)

davidmatson avatar Sep 01 '22 19:09 davidmatson

And just to clarify, the "streaming" here is specifically what --gtest_stream_result_to does.

davidmatson avatar Sep 14 '22 17:09 davidmatson

Thanks. I don't see an immediate problem with this but I don't think we're going to find time to prioritize this effort. I'd suggest using the json or xml output if possible.

asoffer avatar Sep 23 '22 19:09 asoffer

@asoffer - I'm hoping to make use of this data in a situation where we need to get this information during test execution. I don't think JSON or XML will work for that scenario since they're not streaming.

Would you be open to a PR to make this data available during test execution via --gtest_stream_results_to?

davidmatson avatar Sep 23 '22 19:09 davidmatson