1

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

Community
  • 1
  • 1
Dmitry Bakaev
  • 129
  • 2
  • 14

1 Answers1

4

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

nunit-console.exe MyProject.dll /run:"MyNamespace.MyClass.Test1(\"option1\")"
Joachim Isaksson
  • 176,943
  • 25
  • 281
  • 294
  • Thanks once again! You saved tons of time for me. – Dmitry Bakaev Nov 15 '12 at 20:01
  • If you have multiple parameters, make sure that you don't put a space after the delimiting commas. It should be like this: `nunit-console.exe MyProject.dll /run:"MyNamespace.MyClass.Test1(\"option1\",\"option2\",\"option3\")"`. – sfarbota Mar 04 '14 at 16:13
  • 1
    Also, make sure that the parameters you are passing actually exist together as a TestFixture in the code! Arrrg... – sfarbota Mar 07 '14 at 19:32