← Back to team overview

nunit-core team mailing list archive

[Bug 809947] Re: SetUpFixture with parameter

 

Sorry for being late

[TestFixture("GiantDb", "DbPass", IgnoreReason="does not work")]
[TestFixture("SmallDb", "DbPass")]
public class MultiDbTest
{
  public MultiDbTest(string dbName, string dbPass)
  {
    // store connection data
  }

  [SetUp]
  public SetUp()
  {
    // connect to database
  }
  ...
} 

Would run all tests twice, on for GiantDb (but ignored) and for SmallDb.

So what I want to have is the same feature for the whole namespace. I
don't want a database connect for every class (because does need a long
time). This can I solve with a class attributed with SetUpFixture, but
only for one database. I want to give more databases, something like the
following. And all tests in the namespace will run twice.

[SetUpFixture ("GiantDb", "DbPass", IgnoreReason="does not work")]
[SetUpFixture ("SmallDb", "DbPass")]
public class MultiDbTest
{
  public MultiDbTest(string dbName, string dbPass)
  {
    // store connection data
  }

  [SetUp]
  public SetUp()
  {
    // connect to database
  }
  ...
} 

Is it clear?

-- 
You received this bug notification because you are a member of NUnit
Core Developers, which is the registrant for NUnit Framework.
https://bugs.launchpad.net/bugs/809947

Title:
  SetUpFixture with parameter

Status in NUnit Test Framework:
  New

Bug description:
  SetUpFixture should have the same possibilities with paramater as
  TextFixture, so that the class can have constructors with parameters.

  [TestFixture("GiantDb", "DbPass", IgnoreReason="does not work")]
  [TestFixture("SmallDb", "DbPass")]

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunit-3.0/+bug/809947/+subscriptions


Follow ups

References