Search code examples
nunit-3.0nunit-console

Running Test Cases Separately Nunit Console Runner


I am developing tests using Nunit3 and have several test cases for one method. I want to run test cases separately using Nunit console runner. How can I achieve this?

[TestCase(12,3,4)]
[TestCase(12,2,6)]
[TestCase(12,4,3)]
public void DivideTest(int n, int d, int q)
{
  Assert.AreEqual( q, n / d );
}

Something like this runs all the test cases in the end.

nunit3-console.exe --test=DivideTest(12,3,4) path/to/your/test.dll

Solution

  • Naming the test case provided what I was looking for as a workaround:

    [TestCase(12,3,4 TestName="foo"))]
    public void DivideTest(int n, int d, int q)
    {
      Assert.AreEqual( q, n / d );
    }
    
    nunit3-console.exe --test=foo path/to/your/test.dll