开发者

NUnit Tests in generic abstract base class are ignored

I have create a generic abstract base class to do some common tests. The test are showing up, but they are ignored. Why? Example

public abstract class FooBase<TA, TB> : TestBase<TA, TB>
{
   [Test]
   public void SomeBaseTest(){}
}

[TestFixture]
public class ConcreteFooTest:FooBase<IFoo,MyContext>
{
   [Test]
   public void WorkingTest(){}
}

It this example are SomeBaseTest ig开发者_如何学JAVAnored. TestBase are used by all my tests and are only containing some help methods, and no tests


As Ritch states it is due to RS' test runner. This is a bug in RS 6.0 which is scheduled for fix in 6.1. See RSRP-273687 Unit test runner shows inconclusive with test class with generic base class.


Which test runner are you using?

And have you tried to add the TestFixture attribute?

[TestFixture]
public abstract class FooBase<TA, TB> : TestBase<TA, TB>
{
    [Test]
    public void SomeBaseTest(){}
}


The problem is likely with your test runner. Nunit 2.5.10's test runner ran it, Autotest.Net (1.3.1) ran it, and Resharper 6.0's test runner saw it, but wouldn't automatically run it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜