This Question is Possibly Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
5 Replies Last post: Jul 19, 2013 8:00 PM by Jon Stelly  
Jon Kruger Newbie 9 posts since
Nov 26, 2008
Currently Being Moderated

Jul 15, 2013 10:10 PM

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.

Matt Ellis Novice 305 posts since
Jul 5, 2009
Currently Being Moderated
Jul 16, 2013 2:09 PM in response to: Jon Kruger
Re: MSTest tests keep running even after I stop them

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.

Matt Ellis Novice 305 posts since
Jul 5, 2009
Currently Being Moderated
Jul 16, 2013 4:48 PM in response to: Jon Kruger
Re: MSTest tests keep running even after I stop them

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

Jon Stelly Newbie 15 posts since
Nov 10, 2011
Currently Being Moderated
Jul 19, 2013 8:00 PM in response to: Jon Kruger
Re: MSTest tests keep running even after I stop them

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.

More Like This

  • Retrieving data ...