NCrunch is attempting to run tests in a class which is not marked as a test fixture.
Specifically, I have a base class which has several methods marked with [Test], as well as a setup method marked with [SetUp]
Example:
public class BaseTestClass {
[SetUp]
public void MySetup() {}
public virtual void ExtraSetupSteps() {}
[Test]
public void Test1() {}
[Test]
public void Test2() {}
}
Then, there are two other classes which extend the base class:
Example:
[TestFixture]
public class MyRealTestClass: BaseTestClass {
public override void ExtraSetupSteps() {/*stuff*/}
[Test]
public void Test3() {}
}
When running directly with TestDriven.Net, Gallio, etc, the base class is skipped over and only the extending class (marked with [TestFixture]) is attempted. However, NCrunch shows errors for the base class, implying that it attempted to execute the class directly.
Note: To resolve this issue, I simply marked the base class as abstract (which it should have been anyway) and NCrunch happy skipped over it going forward.
I'm using MbUnit v3.3 with NCrunch v1.37.0.46b in Visual Studio 2010 Ultimate
Build/Test Issues
attempts to run tests in class not marked with [TestFixture]
Started by johnmwright on 6,276 views
Remco NCrunch Developer
#1194
23 Feb 2012 20:08 UTC
Hi John -
This isn't something that was obvious to many people (including myself at the time actually), but with the introduction of NUnit 2.5, NUnit will now run tests without a [TestFixture] attribute being present on the test class.
So what you've described is actually the intended behaviour. The fix you've implemented (make the class abstract) is also the exact right thing to do in this situation :)
Cheers,
Remco
This isn't something that was obvious to many people (including myself at the time actually), but with the introduction of NUnit 2.5, NUnit will now run tests without a [TestFixture] attribute being present on the test class.
So what you've described is actually the intended behaviour. The fix you've implemented (make the class abstract) is also the exact right thing to do in this situation :)
Cheers,
Remco
Post a reply
Log in to reply.