Dmitry Bakaev
Dmitry Bakaev

Reputation: 139

nunit-console does not run tests parameterized with TestCase attribute

Trying to run Nunit tests parameterized with TestCase attribute. Something like this:

[TestFixture]
public class MyClass
{
    [Test]
    [TestCase("option1")]
    [TestCase("option2")]
    public void Test1(string id)
    {

    }
}

And when I am trying to run this tests using nunit console

nunit-console.exe MyProject.dll /run:MyNamespace.MyClass.Test1

it works fine. But at attempt to run it parameterized:

nunit-console.exe MyProject.dll /run:MyNamespace.MyClass.Test1("option1")

it just shows:

Tests run: 0, Errors: 0, Failures: 0, Inconclusive: 0, Time: 0.0269838 seconds Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0

Upvotes: 1

Views: 1639

Answers (1)

Joachim Isaksson
Joachim Isaksson

Reputation: 180917

From what I remember it needs to be quoted a bit differently;

nunit-console.exe MyProject.dll /run:"MyNamespace.MyClass.Test1(\"option1\")"

Upvotes: 4

Related Questions