英文:
Microsoft Native Unit Test for C++ - where is the Logger output going?
问题
尝试在Visual Studio 2019中进行C++单元测试。已将C++“本机单元测试项目”添加到我的解决方案中。然后添加了以下“Logger”消息:
TEST_CLASS_INITIALIZE(ClassInitialize)
{
Logger::WriteMessage("在测试类上设置。这将出现在哪里?");
}
// ...
TEST_METHOD(TestMethod1)
{
Logger::WriteMessage("测试方法。这条消息将显示在哪里?");
}
这些测试由Visual Studio的“测试资源管理器”捕获并成功运行。如果进行调试,还会触发断点。根据Microsoft Logger文档,输出应该显示在Visual Studio的“输出窗口”中,但消息未显示。
Logger
将其输出发送到哪里?
英文:
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.
Where is Logger
sending its' output?
答案1
得分: 1
尽管MS文档中提到"The logger class contains static methods to write to the Output Window",但现在似乎不再是这样的情况了。
Logger
类的输出现在可以在执行单元测试后在测试详细摘要中看到。
包含在TEST_METHOD(TestMethod1)
中的Logger::WriteMessage
的输出将出现在给定单元测试的测试详细摘要中。
包含在TEST_CLASS_INITIALIZE(ClassInitialize)
中的Logger::WriteMessage
的输出将出现在执行该测试运行期间的第一个测试方法中。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论