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