Can I force the NUnit GUI to enter the Visual Studio debugger in a break / fail point test?

When using the NUnit GUI to run unit tests, is there a way:

  • Set breakpoints inside tests,
  • or a break in the Visual Studio "Just-in-Time" debugger after a test failure?
+5
source share
5 answers

Your first requirement is very simple. Attach the VS debugger to the NUnit GUI ( Tools-> Attach to Process ) and set breakpoints accordingly. When tests are run with the debugger attached, breakpoints will be deleted.

, ( , , , , ). unit test , NUnit NUnit.Framework.AssertionException. , , , . - > ..., .... ( ) NUnit. , .

, , , .

+5

, . . unit test "", " :", nunit.exe, DLL " " (, UnitTests.dll)

+6

Visual Studio NUnit, NUnit.

+3

If you attach the Visual Studio debugger to the nunit process and run your test in nunit, then breakpoints in Visual Studio will be used.

I do not know how this can be done if the test fails.

+1
source

In addition to connecting to the NUnit process, you can temporarily add

Debugger.Launch()

either in SetUpFixture or TestFixtureSetUp or even in an attempt to catch where the expected exception is caught.

0
source

All Articles