mardi 10 novembre 2020

How to get FullName as TestName in NUnit

I have an abstract test class, that contains test methods. Then some classes that derive from this abstract class. The TestExplorer recognizes the class deriving from abstract class structure, but the testNames are only with abstract class. I would need to show NUNIT the fullName of test method, including the class, not only the abstract name.

  • the TestName pattern {M}{a} gives me: NUnitTestProject1.Tests.Test1("hello")

  • the FullName would be: NUnitTestProject1.NUnitTestProject1.Tests+TestImplement.NUnitTestProject1.Tests.NUnitTestProject1.Tests.Test1("hello")

I am missing the "TestImplementation1" class name. How can I tell NUnit to show the Full name as TestName (i need the "Tests+TestImplement1" information)? Great would be something global like runsettings file. TestExplorerView. I tried different nunit patterns, also runsettings file with <DisplayName>FullNameSep</DisplayName>.

thanks in advance!

simplyfied test class:

public abstract class Tests
{

    public class TestImplement1 : Tests
    {
    }

    public class TestImplement2 : Tests
    {
    }

    [Test]
    [TestCase("hello", TestName = "{M}{a}")]
    public void Test1(string param1)
    {
        Assert.Pass();
    }
}

Aucun commentaire:

Enregistrer un commentaire