Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio native unit testing: Debug/console output?

Tags:

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".

like image 734
Robinson Avatar asked May 29 '15 11:05

Robinson


People also ask

How do I view test output in Visual Studio?

Run tests in Test Explorer If Test Explorer is not visible, choose Test on the Visual Studio menu, choose Windows, and then choose Test Explorer (or press Ctrl + E, T). As you run, write, and rerun your tests, the Test Explorer displays the results in a default grouping of Project, Namespace, and Class.

How do you Debug a unit test project?

To start debugging: In the Visual Studio editor, set a breakpoint in one or more test methods that you want to debug. Because test methods can run in any order, set breakpoints in all the test methods that you want to debug. In Test Explorer, select the test method(s) and then choose Debug on the right-click menu.


1 Answers

In the unit test code, you can use

Logger::WriteMessage("My message string"); 

and the message will appear in the Output window.

like image 51
Brian Avatar answered Sep 29 '22 15:09

Brian