Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 723
Andre Borges Avatar asked Oct 14 '16 08:10

Andre Borges


1 Answers

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:

enter image description here

like image 50
Alexandru Marculescu Avatar answered Nov 01 '22 03:11

Alexandru Marculescu