Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Microsoft Native Unit Test for C++ – where is the Logger output going?

Trying out C++ unit testing in Visual Studio 2019. Have added a C++ Native Unit Test Project unit test project to my solution. Then added the following Logger messages:

TEST_CLASS_INITIALIZE(ClassInitialize)
{
    Logger::WriteMessage("Setup on test class. Where will this appear?");
}

// ...

TEST_METHOD(TestMethod1)
{
    Logger::WriteMessage("Test method. Where is this message going??");
}

The tests are picked up by the Visual Studio Test Explorer and run successfully. Breakpoints are also hit if the tests are debugged. According to the Microsoft documentation on Logger, output should appear in the Visual Studio Output Window, but the messages are not being displayed.

here does Logger send its’ output?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Although the MS documentation states "The logger class contains static methods to write to the Output Window" this no longer seems to be the case.

The output from the Logger Class can now be seen in the Test Detail Summary, after the unit tests have been run.

Output from the Logger::WriteMessage that is contained in TEST_METHOD(TestMethod1) will appear in the Test Detail Summary for that given unit test.

Output from the Logger::WriteMessage that is contained in TEST_CLASS_INITIALIZE(ClassInitialize) will appear in the first test method that is executed during that test run.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading