Search code examples
c#automated-testsnunit

NUnit Visual Studio run TearDown on test cancel


Is there a way to make NUnit tests run their [TearDown] method when a test is interrupted by clicking on "Cancel" in the Test Explorer?

At the moment all that happens is the test stops executing and the browser stays open.

Thanks


Solution

  • As far as I know, if you cancel the test running, VS simply stops the execution, nothing more of your code is executed, even "IDisposable" implementation or "try/finally" statements.