Nunit does not run SetUp method in Visual Studio debugging mode

I try to debug tests after calling the installation method, and the tests depend on the installation method being called.

I am using Nunit 2.6.0.12051, a testing .NET 4.0 class library. The nunit Visual Studio project has a class marked [SetUpFixture] and a method marked [SetUp].

If I run tests from NUnit gui, I am pretty sure that the assignment attribute class is called (because it is not stopped in the installation class with an error at runtime), but I cannot debug it. If I try to change the settings to see Verbose Tracing, NUnit gui will issue an unhandled checkout.

If I run tests from Visual Studio using Test View / Debug Selection, the breakpoint in the installation method does not stop execution, and the trace statements inside the method do not print in the debug window. Therefore, I am sure that the configuration method is not called.

While I could just change the installation class to be the base of all test classes, I only need one method run.

Any help would be wonderful.

+8
unit-testing installation visual-studio-2010 nunit
source share
3 answers

I just ran into this problem and ended up finding this significant suggestion from the NUnit SetUpFixture Documentation :

"This is an attribute that marks a class that contains one-time setup or disassembly methods for all test fixtures under a specific namespace."

It turned out that my SetUpFixture class was in a completely different namespace than my tests, so it did not start.

+3
source share

I just noticed the same thing when I used the latest NUnit from NuGet (2.6). The [Setup] method does not start before the [Test] methods.

I don’t know why they changed this rather significant part of NUnit, but I fixed it for my purposes, returning to version 2.5.10, which launches [Setup] before [Test].

+2
source share

I also had this problem, but installing the latest version of the test runner (TestDriven.NET in my case) fixed it. For me, this is not a NUnit problem.

+1
source share

All Articles