MSTest tests keep running even after I stop them

I'm using R# 7.1.3 with VS2012 and I'm running MSTest tests in the test runner.  If in the middle of the run I click the Stop button to stop the tests, the UI makes it look like the tests stopped running, but they continue to run in the background.  If I immediately start running them again, you can get weird behavior with multiple instances of the same tests can be running.

5 comments

The test runner handles stopping tests in a two-step process. The first time you click the stop button, it sends a request to the runner to stop the tests. However, the runner is busy running your code, and doesn't know if it's safe to interrupt. So it waits for the end of the test and then stops the tests and cleans up.

However, if your tests are long running, or you're stuck in an infinite loop, this could take a while. So you can click the stop button a second time, and the runner process is terminated. This is quick, but it means none of your teardown code is called, which might leave your tests in an inconsistent state (perhaps your teardown deletes files or resets a database. ReSharper can't and doesn't know this)

So, if you're having problems with it taking a while to stop your tests (the UI should still show feedback at this point), click the stop button a second time.

0

I do click the Stop button twice, the tests still keep running in the background.  When this happens, the tests don't turn red or green in the test runner, but I can see in the database that they are still running.  

0

Is the JetBrains.ReSharper.TaskRunner.exe process still running?

0

That process is never running.  While the tests are running I do have vstest.discoveryengine.exe and vstest.executionengine.x86.exe running, I'm guessing that these are the processes that need to stop but aren't.  

0

Same behavior here, seen it since 7.0 and it's still happening in the 8.0 EAP from 7/12.  7/12 EAP actually got a bit worse, debugging a bunch of unit tests, if you stop/cancel the test, it only cancels the currently executing test, but continues and runs the next test.

0

Please sign in to leave a comment.