Comment 2 for bug 809947

Revision history for this message
Rechenelf (matklaus) wrote :

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?