Question

I have a base test class containing some test cases and some ordinary tests:

[TestFixture]
public abstract class TestBase
{
  [TestCase(1)]
  [TestCase(2)]
  [TestCase(3)]
  public void TestA(int value)
  {
    // Perform test
  }

  [Test]
  public void TestB()
  {
    // Perform test
  }
}

These tests are run from child classes which set up the environment in different ways. The child classes only contains setup methods, no tests.

[TestFixture]
public class LocalDatabaseTest : TestBase
{
  [SetUp]
  public void SetUp()
  {
    // Set up environment to use local db
  }
}

I'm using ReSharper 6.1.1000.82 to run all tests in LocalDatabaseTest, but only the ordinary tests are run. The tests using TestCase does not get any result. If I select Run All on TestA in the TestBase class, all test cases are run (including the other child classes). I'm using NUnit 2.6.2.12296. Any ideas on what I've done wrong?

Was it helpful?

Solution

You've done nothing wrong.

If you open your test dll via NUnit test runner you will see all test are running successfully.
(I just verified your code with NUnit 2.6.2).

Regarding the reason of ignoring parameterized tests on Resharper: It seems there is some issue with Resharper test runner which causes such behavior.
So, my suggestion is to use NUnit to run parameterized tests.

Btw, Resharper 7 has better support NUnit parameterized tests. And probably this issue won't appear in the latest Resharper version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top