Bercovici Adrian
Bercovici Adrian

Reputation: 9360

Running all tests but stop and debug one of them

I am testing a .NET dll and i have written 5 NUnit tests against it.All tests share a common object that gets initialized in the OneTimeSetUp.When i press RunAll 4/5 tests return correct.The fifth one works fine when running alone.

Is there any way to put the breakpoint in your target testcase,select Run-all and stop where you need? I need to inspect the state of the shared object in the test that fails.

Is it possible?

Example

public class State
{
  public int Value;
}

public class Tests{
   public State state=new State();
   [Testcase]
    public void Test1()
    {
      state.Value=1;
     }

   [Testcase]
   public void Test2()
   {
      state.Value=2;
   }
   ......
   [Testcase]
   public void TestN()
   {
     -----breakpoint
   }
}

Upvotes: 0

Views: 56

Answers (1)

DieGraueEminenz
DieGraueEminenz

Reputation: 880

Please try to use "debug" instead of "run all". Your run should stop on your breakpoint.

Upvotes: 4

Related Questions