goodfella / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Have name field in XML include testsuite name and optional command line or #define compile time prefix #270

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When using xml output to report test results into CruiseControl.NET, 
CruiseControl.NET only shows the testcase name and does not tell you which 
testsuite that testcase was a part of.  For example:

expected: <testcase name="RFSWait.Timeout" status="run" time="0.25" 
classname="RFSWait" />
actual:   <testcase name="Timeout" status="run" time="0.25" 
classname="RFSWait" />

The additional information in the testcase name would help in finding the 
failed test and make it easier to re-run just the failing test using gtest-
filter.

Additionally, I would like to combine XML test results in CruiseControl.NET 
from different build options (release/debug and x86/x64).  Currently, 
because all test code, despite being generated with the different compile 
options generates tests names that are identical for these different 
builds.

It would be useful if I could specify at compile or runtime a prefix to put 
before all test names in the XML output so that combined test results from 
different builds can be uniquely identified.  For example:

mytest.exe --gtest-prefix=x86debug --gtest-output=xml
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from x86debug.RFSWait
[ RUN      ] x86debug.RFSWait.Timeout
[       OK ] x86debug.RFSWait.Timeout (250 ms)
[ RUN      ] x86debug.RFSWait.Constructor
testSync.cpp(27): error: Value of: 1
Expected: waitTrue.Wait(0)
Which is: 0
[  FAILED  ] RFSWait.Constructor (1 ms)
[----------] 2 tests from RFSWait (253 ms total)
[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (255 ms total)
[  PASSED  ] 1 test.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] x86debug.RFSWait.Constructor
 1 FAILED TEST

And in the XML: 
expect: <testcase name="x86debug.RFSWait.Timeout" status="run" time="0.25" 
classname="RFSWait" />

Original issue reported on code.google.com by BitO...@gmail.com on 31 Mar 2010 at 7:42

GoogleCodeExporter commented 9 years ago
Changing the format of Google Test's standard XML output is likely to break 
many tools that already work with 
it. 

There is a couple of things you can do to achieve the desired output format 
without changing the default one. 
First, you can use simple XSLT transformations to combine existing XML 
attributes into a desired form or 
prepend a desired prefix. Second you can write a custom XML output generator 
using Google Test's event 
listener API (see 
http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide#Extending_Googl
e_Test_by_Handling_
Test_Events and http://www.google.com/codesearch/p?
hl=en#DwxMT4dmL0s/trunk/src/gtest.cc&q=XmlUnitTestResultPrinter%20package:http:/
/googletest%5C.goo
glecode%5C.com&sa=N&cd=1&ct=rc&l=97).

Original comment by vladlosev on 31 Mar 2010 at 8:50

GoogleCodeExporter commented 9 years ago
Is there a way to record a property for all tests like using the function 
::testing::Test::RecordProperty or some other equivalent before calling 
RUN_ALL_TESTS() 
or Global Set-Up functions? 

Original comment by BitO...@gmail.com on 2 Apr 2010 at 3:09

GoogleCodeExporter commented 9 years ago
Currently no; we are tracking that in issue 250 
(http://code.google.com/p/googletest/issues/detail?id=250).

Original comment by vladlosev on 2 Apr 2010 at 8:53