Skip to content

Overriden tests are not discovered in NUnit 3.12.0 #3274

Description

@estrizhok

Given the following hierarchy of two classes, where an inheritor overrides one of the tests of its parent:

using System.Collections.Generic;
using NUnit.Framework;

namespace Test
{
  public class BaseClass
  {
    [Test] public virtual void Test01() { }
    [Test] public virtual void Test02() { }
  }

  public class ConcreteClass : BaseClass
  {
    [Ignore("Ignored in inheritor")]
    public override void Test01() { }
  }
}

Running discovery results in NUnit not finding the overriden test:

<test-run id="2" name="ClassLibrary7.dll" fullname="C:\Users\Eugene.Strizhok\Source\Repos\ClassLibrary7\ClassLibrary7\bin\Debug\ClassLibrary7.dll" testcasecount="3">
  <test-suite type="Assembly" id="0-1005" name="ClassLibrary7.dll" fullname="C:\Users\Eugene.Strizhok\Source\Repos\ClassLibrary7\ClassLibrary7\bin\Debug\ClassLibrary7.dll" runstate="Runnable" testcasecount="3">
    <properties>
      <property name="_PID" value="15568" />
      <property name="_APPDOMAIN" value="Tests: ClassLibrary7" />
    </properties>
    <test-suite type="TestSuite" id="0-1006" name="ClassLibrary7" fullname="ClassLibrary7" runstate="Runnable" testcasecount="3">
      <test-suite type="TestFixture" id="0-1000" name="BaseClass" fullname="ClassLibrary7.BaseClass" classname="ClassLibrary7.BaseClass" runstate="Runnable" testcasecount="2">
        <test-case id="0-1001" name="Test01" fullname="ClassLibrary7.BaseClass.Test01" methodname="Test01" classname="ClassLibrary7.BaseClass" runstate="Runnable" seed="707603294" />
        <test-case id="0-1002" name="Test02" fullname="ClassLibrary7.BaseClass.Test02" methodname="Test02" classname="ClassLibrary7.BaseClass" runstate="Runnable" seed="2131982348" />
      </test-suite>
      <test-suite type="TestFixture" id="0-1003" name="ConcreteClass" fullname="ClassLibrary7.ConcreteClass" classname="ClassLibrary7.ConcreteClass" runstate="Runnable" testcasecount="1">
        <test-case id="0-1004" name="Test02" fullname="ClassLibrary7.ConcreteClass.Test02" methodname="Test02" classname="ClassLibrary7.BaseClass" runstate="Runnable" seed="558787989" />
      </test-suite>
    </test-suite>
  </test-suite>
</test-run>

Despite TestAttribute being defined as inherited:

[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class TestAttribute : NUnitAttribute, ISimpleTestBuilder, IApplyToTest, IImplyFixture { ... }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions