superupon / googletest

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

Gtests run under Visual Studio but not under Team Build #203

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Build a google test based test suite under MS Team Build (not Visual
Studio) 

What is the expected output? What do you see instead?
Expected: same output as run under VS2008
Actual: gtests can't run because Team Build is a windows service without
any windowing environment, so it can't instantiate the command window that
gtest sends its outputs to.

What version of the product are you using? On what operating system? G130
on VS2008 under XP Sp3

Please provide any additional information below.
What would be the best way to make a gtest test suite (i.e. a gtest.lib)
such that running gtest_main would not call for the opening of a command
window.  For example how might one eliminate ALL stdout and stderr from
gtest to the console and, say, replace it with output to a named file.?

Thanks, Peter Schwenn   peter@schwenn.com

Original issue reported on code.google.com by pschw...@gmail.com on 5 Oct 2009 at 6:08

GoogleCodeExporter commented 9 years ago
Hi Peter,

You can use the event listener API to override the default text output: 
http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide#Extending_Googl
e_Test
_by_Handling_Test_Events

Please email googletestframework@googlegroups.com if you have further questions.

Original comment by zhanyong...@gmail.com on 5 Oct 2009 at 9:01

GoogleCodeExporter commented 9 years ago
Zhanyong.wan

I saw the Adv.Guide section you mentioned, and it does claim that, and I'm sure 
it
can but the examples given don't directly have to do with suppressing and 
replacing
default outputs.  So I'll have to study that section more carefully to learn 
how to
use event listeners to do it.

Thanks, Peter Schwenn

Original comment by pschw...@gmail.com on 5 Oct 2009 at 9:13

GoogleCodeExporter commented 9 years ago
Zhanyong.wan

What I'm trying to suppress or replace is not particular outputs, or "most" of 
the
default text output, but the Console App nature of Google Test -- i.e. its ever
having a default output stream of "console out" or ever taking any action that 
would
result in the opening of a command window.

Perhaps you could help me by verifying where the defaults for stdout and stderr 
are
setup in the Google Test source code.  I suppose they may be in the <iostream>
header, but I do not find them.

Thank you, Peter Schwenn

Original comment by pschw...@gmail.com on 6 Oct 2009 at 4:39

GoogleCodeExporter commented 9 years ago
Dear Zhanyong Wan and anyone else interested in getting Gtest to run as a 
Visual 
Studio post-build-event even under Team Build,

I have been able to inhibit my Gtest app executable from popping up a Command 
Window 
or a Windows window by re-defining it as a Windows app rather than a Console 
app (in 
Visual Studio terms), and then gutting the InitInstance routine which 
instantiates a 
startup window.

(I have not been able to verify yet that my Gtest app is happy to run in a 
windowless environment but it should be.)

This means that Gtest can be used in the automating context of MS Team Build, 
for 
example, to unit test "unmanaged" C++ code or mixed managed&unmanaged C++ 
projects, 
which Microsoft Build tool's unit testing frameworks cannot do.

Peter Schwenn

Original comment by pschw...@gmail.com on 7 Oct 2009 at 11:46