I Want to exclude only 1 test case parameter from the below during comman line execution
nunit3-console.exe Excel.Test.dll --where="cat!=IgnoreForNow"
but this excludes all the parameters(A, B, C, D)
[TestCase("A"), Category("IgnoreForNow")]
[TestCase("B")]
[TestCase("C")]
[TestCase("D")]
public void TestReports(string fileName)
{
Test("foo", fileName);
}
I don't want to use ignore attribute as I want to skip this test case execution in the build system but want to execute them locally.
Is there any way in NUnit while executing from command line
Your approach and command line are correct, but the way you are currently using the category attribute is incorrect.
What you currently have, is equivalent to the below in C# terms:
[TestCase("A")]
[TestCase("B")]
[TestCase("C")]
[TestCase("D")]
[Category("IgnoreForNow")]
public void TestReports(string fileName)
{
Test("foo", fileName);
}
By doing this, you're applying the category to the entire TestReports
test suite - which is why all the individual cases are excluded.
What you need to do instead, is use the Category
property on TestCaseAttribute
, as below:
[TestCase("A", Category="IgnoreForNow")]
[TestCase("B")]
[TestCase("C")]
[TestCase("D")]
public void TestReports(string fileName)
{
Test("foo", fileName);
}