问题
Can anyone tell me how to enable or get debug or console text output when running unit tests in a native (C++) test project in Visual Studio 2012?
Answer should not include the phrase, "use Google Test".
回答1:
In the unit test code, you can use
Logger::WriteMessage("My message string");
and the message will appear in the Output window.
回答2:
Brian's answer is correct. Use
Logger::WriteMessage("some text");
and run the test normally (there is no need to debug). However, you also need to select "Tests" in the "Show output from" drop-down list at the top of the Output window.
VS 2013 Output window with Tests output selected
回答3:
The debug output shows in the debug output window if you right-click and choose `debug' on whichever test in the test explorer window. Otherwise it doesn't.
来源:https://stackoverflow.com/questions/30528368/visual-studio-native-unit-testing-debug-console-output