Duplicate test using abstract test fixtures

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

Bug Description

Reported on nunit-discuss by Victor Kropp:

I've found bug in NUnit 2.5.5 with abstract TestFixtures.
Please find the sample in attached file.

You'll see DuplicateTest 2 times (actually, as much as marked abstract classes in hierarchy)
If non-abstract class is marked as TestFixture test appears only once.

This bug was introduced in version 2.5.3.

Code that reproduces this bug...

using NUnit.Framework;

namespace NUnitBug
{
  [TestFixture]
  public abstract class NUnitDuplicateTestsBaseBaseBase
  {
  }

  [TestFixture]
  public abstract class NUnitDuplicateTestsBaseBase : NUnitDuplicateTestsBaseBaseBase
  {
  }

  public class NUnitDuplicateTests : NUnitDuplicateTestsBaseBase
  {
    [Test]
    public void DuplicateTest()
    {
    }
  }
}

Tags: v2port

Related branches

description: updated
Changed in nunitv2:
status: New → In Progress
importance: Undecided → Low
assignee: nobody → Charlie Poole (charlie.poole)
importance: Low → Medium
milestone: none → 2.5.6
Revision history for this message
Charlie Poole (charlie.poole) wrote :

Yes, this is the result of a hack I put in to fix another bug - I feared it would
come back and bite me!

The root cause is that TestFixtureAttribute serves three different purposes:
1) To simpy mark a class as a fixture
2) To provide type arguments for a generic fixture
2) To provide actual arguments for constructing a parameterized fixture

It seemed like a nice idea at the time :-(

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.