Visual Studio native unit testing: Debug/console output?

烈酒焚心 提交于 2019-12-22 01:39:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!