Generic Test Instances disappear

Bug #611938 reported by Charlie Poole
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
NUnit Framework
High
Charlie Poole
NUnit V2
Fix Released
High
Charlie Poole

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.

Related branches

Changed in nunitv2:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Charlie Poole (charlie.poole)
Changed in nunit-3.0:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Charlie Poole (charlie.poole)
Changed in nunitv2:
status: Triaged → Fix Committed
milestone: none → 2.5.7
Changed in nunitv2:
status: Fix Committed → Fix Released
Changed in nunit-3.0:
status: Triaged → Fix Committed
Changed in nunit-3.0:
milestone: none → 2.9.6
tags: added: framework
Changed in nunit-3.0:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers