A simple solution is this.
All your test cases are in an abstract class, for example, in the TestBase class. For example:
public abstract class TestBase { protected string SetupMethodWas = ""; [Test] public void ExampleTest() { Console.Out.WriteLine(SetupMethodWas); }
Then you create two subclasses for each installation. Thus, each subclass will be launched individually using the installation method and all inherited test methods.
[TestFixture] class TestA : TestBase { [SetUp] public void Setup() { SetupMethodWas = "SetupOf-A"; } } [TestFixture] class TestB : TestBase { [SetUp] public void Setup() { SetupMethodWas = "TestB"; } }
It is wonderful. However, for simpler tests, parameterized tests are the best solution.
Gamlor Mar 07 '10 at 22:29 2010-03-07 22:29
source share