How to prevent expected exceptions from breaking the debug test run?

后端 未结 3 1753
说谎
说谎 2020-12-19 01:03

When running MSTEST unit tests in debug mode, the execution stops in every expected exception that is thrown. My test looks like this

[TestMethod()]
[Expecte         


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-19 01:43

    CTRL + R A works for me without changing any option.

    I think the problem you have is because you are running the test project from the Start Debugging (F5) button on the toolbar. If you click the green play button, you will stop in every exception, even expected ones.

    To run all tests without stopping in every exception, click on: Test -> Run -> All Tests in Solution or use the shortcut: CTRL + R, A

    With the test results window open, CTRL + R, D also works. In the test results window it becomes clear the difference between Run Tests and Debug tests.

提交回复
热议问题