0

For my project I want to run the exact same test cases twice, once locally and on a different VM in parallel in the cloud (Azure in my case).

I duplicated the TestCase and tagged one Category("Local") and the other Category("Cloud"). Running nunit3 from the console with --where="cat == Cloud" will thus run all TestCases of every test that has one or more TestCases tagged with Category("Cloud").

Is there a different way of only running selected TestCases by a commandline switch?

Simplified example:

[TestCase(TestName = "Canary, Run in cloud."), Category("Cloud")]
[TestCase(TestName = "Canary, Run locally."), Category("Local")]
public void Canary()
{
    Assert.True(true);
}

1 Answers1

0

Found a work-around. Using --params:Cloud=true as command line argument and in the code

private bool ShallRunInCloud => TestContext.Parameters["Cloud"]?.ToLowerInvariant() == "true";