当前 运行 是哪个单元测试?
Which unit test is currently running?
这个问题与我的单元测试程序崩溃的问题有关,但我不知道在哪个单元测试上。
我意识到这个问题与 How can I find out which test method in a batch of test methods fails to run? 重复,但我仍然需要尝试:
我正在 运行 进行一些单元测试(大约 118 个),但其中一个似乎使 Visual Studio 单元测试环境崩溃。这是我在 "output" window 的 "Tests" 选项卡中看到的:
[5/02/2018 11:13:18 Informational] ------ Run test started ------
[5/02/2018 11:13:38 Error] The active Test Run was aborted because the execution process exited unexpectedly. The test execution process crashed while running the tests. To investigate further, open file:///C:/Users/DominiqueDS/AppData/Local/CrashDumps/vstest.executionengine.x86.exe.19136.dmp file in Visual Studio and choose "Debug in mixed mode".
[5/02/2018 11:13:38 Informational] ========== Run test finished: 65 run (0:00:19,6926824) ==========
我拥有该转储文件的原因是我的 Windows 配置在应用程序崩溃时自动创建此类转储文件。 (此配置的过程可在 this URL 下找到)
检查转储文件为我提供了有关测试的更多信息,该测试失败了:我有一种预感可以找到它,在另一个线程中,我找到了一个函数,调用了一个 method
似乎包含单元测试的名称我 运行ning.
虽然我知道哪个测试失败了,但它是基于预感和我什至不应该生成的转储文件,所以我正在寻找另一个解决方案:
在文件 "c:\Program Files (x86)\Microsoft Visual Studio17\Professional\VC\Auxiliary\VS\UnitTest\include\CppUnitTest.h" 的函数 TEST_METHOD
中,我尝试添加以下行:
cout << "Test : ";\
cout << methodName;\
cout << "\n";\
我希望这会显示我想要的每个测试 运行,但我却收到错误消息,指出这是错误的(似乎还使用了 std::cout
和 OutputDebugString()
函数不允许)。
因此我的问题是:有没有人知道一种方法来找出,万一我的一个单元测试使我的测试环境崩溃,我如何才能找出这是哪个测试,而不需要生成和调试 Visual Studio转储文件?
供您参考:查看 "Test Explorer" 没有帮助:我有一个禁用测试列表、一个成功测试列表和一个未完成测试列表,我的失败测试是不是 "not finished" 中的第一个。
找到了:我在 TEST_METHOD()
的定义中添加了以下行:
Microsoft::VisualStudio::CppUnitTestFramework::Logger::WriteMessage(L#methodName);\
这个问题与我的单元测试程序崩溃的问题有关,但我不知道在哪个单元测试上。
我意识到这个问题与 How can I find out which test method in a batch of test methods fails to run? 重复,但我仍然需要尝试:
我正在 运行 进行一些单元测试(大约 118 个),但其中一个似乎使 Visual Studio 单元测试环境崩溃。这是我在 "output" window 的 "Tests" 选项卡中看到的:
[5/02/2018 11:13:18 Informational] ------ Run test started ------
[5/02/2018 11:13:38 Error] The active Test Run was aborted because the execution process exited unexpectedly. The test execution process crashed while running the tests. To investigate further, open file:///C:/Users/DominiqueDS/AppData/Local/CrashDumps/vstest.executionengine.x86.exe.19136.dmp file in Visual Studio and choose "Debug in mixed mode".
[5/02/2018 11:13:38 Informational] ========== Run test finished: 65 run (0:00:19,6926824) ==========
我拥有该转储文件的原因是我的 Windows 配置在应用程序崩溃时自动创建此类转储文件。 (此配置的过程可在 this URL 下找到)
检查转储文件为我提供了有关测试的更多信息,该测试失败了:我有一种预感可以找到它,在另一个线程中,我找到了一个函数,调用了一个 method
似乎包含单元测试的名称我 运行ning.
虽然我知道哪个测试失败了,但它是基于预感和我什至不应该生成的转储文件,所以我正在寻找另一个解决方案:
在文件 "c:\Program Files (x86)\Microsoft Visual Studio17\Professional\VC\Auxiliary\VS\UnitTest\include\CppUnitTest.h" 的函数 TEST_METHOD
中,我尝试添加以下行:
cout << "Test : ";\
cout << methodName;\
cout << "\n";\
我希望这会显示我想要的每个测试 运行,但我却收到错误消息,指出这是错误的(似乎还使用了 std::cout
和 OutputDebugString()
函数不允许)。
因此我的问题是:有没有人知道一种方法来找出,万一我的一个单元测试使我的测试环境崩溃,我如何才能找出这是哪个测试,而不需要生成和调试 Visual Studio转储文件?
供您参考:查看 "Test Explorer" 没有帮助:我有一个禁用测试列表、一个成功测试列表和一个未完成测试列表,我的失败测试是不是 "not finished" 中的第一个。
找到了:我在 TEST_METHOD()
的定义中添加了以下行:
Microsoft::VisualStudio::CppUnitTestFramework::Logger::WriteMessage(L#methodName);\