Jaydev
Jaydev

Reputation: 21

how to run more than one test from command line using nunit console runner?

I have list of failed tests (belongs to different classes, namespaces), when I try to run from Jenkins or local command line with below syntax seeing

.\packages\NUnit.ConsoleRunner.3.10.0\tools\nunit3-console.exe --where test==failedTest1,failedTest2,failedTest3 .\ABCTesting\bin\Debug\Api.IntegrationTesting.dll

output Run Settings DisposeRunners: True WorkDirectory: C:\API_IntegrationTesting ImageRuntimeVersion: 4.0.30319 ImageTargetFrameworkName: .NETFramework,Version=v4.7.2 ImageRequiresX86: False ImageRequiresDefaultAppDomainAssemblyResolver: False NumberOfTestWorkers: 12

Test Run Summary Overall result: Passed Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0 Start time: 2021-06-10 20:43:49Z End time: 2021-06-10 20:43:52Z Duration: 2.574 seconds

Upvotes: 0

Views: 644

Answers (1)

Charlie
Charlie

Reputation: 13736

There are two basic problems in the syntax of your where clause...

  1. The comma (',') has no function in a where clause. Consequently, you are telling NUnit to look for a test named "failedTest1,failedTest2,failedTest3". Most likely <g> you don't have a test by that name.

  2. The test operand is specified as the FullName of the test, i.e. the namespace and actual test name.

So the correct syntax in your example could be...

--where "test==My.Namespace.failedTest1 || test==My.Namespace.failedTest2 || test==My.Namespace.failedTest3"

As an alternative approach, you may want to consider using the --testlist option, which allows you to place the test names in a text file, one full name per line.

Upvotes: 1

Related Questions