← Back to team overview

nunit-core team mailing list archive

[Bug 611938] Re: Generic Test Instances disappear

 

** Tags added: framework

-- 
Generic Test Instances disappear
https://bugs.launchpad.net/bugs/611938
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.

Status in NUnit Test Framework: Fix Committed
Status in NUnit V2 Test Framework: Fix Released

Bug description:
NUnit 2.5.6 ignores all instances but one of a generic test fixture that uses a default constructor and has only Type args given
on its TestFixtureAttribute. This is a serious bug since tests simply do not appear and are not run.

For example, this fixture will only be instantiated once - using either the first or the last attribute depending on the runtime.

[TestFixture(typeof(int)]
[TestFixture(typeof(long)]
[TestFixture(typeof(short)]
public class GenericFixture<T> { }

As a workaround, add a single argument to the fixture and all three instances will be created.

[TestFixture(typeof(int), 42]
[TestFixture(typeof(long), 42]
[TestFixture(typeof(short), 42]
public class GenericFixture<T> 
{
   public GenericFixture(int theAnswer) { } 
}

Use of an argument forces the code into a different path that doesn't have the bug.





References