SimonD
SimonD

Reputation: 1547

Strange constructor behaviour in nunit parameterized tests

I have a nunit 2.5.10 parameterized test:

[TestFixture(parameter1)]
[TestFixture(parameter2)]
public class MyTest : BaseTest
{
   var param="";

   public MyTest(string arg)
   {         
       param=arg;
   }

   [Test]  
   public Test()
   {
      //... test stuff
   }
}

In VS 12 with Resharper 7.0.1 I run only one fixture but! the constructor is called twice - once before test execution (for one parameter) and then after test execution but for another parameter. Why? Only constructor is called twice, test itsself is running as expected - only one time.

Upvotes: 0

Views: 265

Answers (1)

kropp
kropp

Reputation: 351

it's a known problem, unfortunately, see RSRP-336641 "When calling certain case on Parametrized TestFixture all cases constructors and TestFixtureSetUp are called."

Upvotes: 1

Related Questions