简体   繁体   中英

How to run tests while debugging

I've been using ReSharper test runner in Visual Studio for quite a while, and there is one thing about it that I can't figure out.

I used to have some integrational tests in my solution that performed web requests to my local web server. I used to be able to launch my web application in debug mode, then launch a test with Resharper test runner within the same Visual Studio instance (that was currently running a debug session), and the test would run normally. The breakpoints in my application were hit, and I was able to debug the requests sent from the test.

However, when I was trying to do the same thing for a new project, the tests fail to launch. When I run any test, Visual Studio displays a modal window asking Do you want to stop debugging? . Why am I unable to run tests while having an active debugging session anymore? What does the ability to do this depend on? Visual Studio version? Resharper version? Unit testing framework (I'm currently using MSTest)?

I think I've seen this behavior before, it seemed to be driven by the fact that Resharper was feeling the need to always build my project/solution before running tests.

Try changing the Build Policy to Never (at first at least) from the Unit Test Sessions window:

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM