简体   繁体   中英

Using Nunit3-Console.exe to run specflow tests but detects tests from only one namespace

Build Environment

project language: C#

.net framework 4.5

OpenCover version 2.5.3427

Specflow version 2.3

Nunit version 3.11.0

Requirement

During build the user will select multiple subsystems acceptance tests and i need to run tests for those subsystems. all the tests are in same assembly but separated by folders(namespace)

I am running the following command

"D:\DEVOPS_TOOLSET\opencover.4.5.3427\OpenCover.Console.exe" -filter:"+[Project.AcceptanceTests]Project.AcceptanceTests.Geometry,Project.AcceptanceTests.Arithmentic  -[nunit*]*" -target:"D:\DEVOPS_TOOLSET\NUnit.ConsoleRunner.3.11.1\tools\nunit3-console.exe" -targetargs:"Project.AcceptanceTests\bin\Release\Project.AcceptanceTests.dll --framework:net-4.5 --result:UnitTestResults.xml --labels=Before --where \"namespace == Project.AcceptanceTests.Geometry || namespace == Project.AcceptanceTests.Arithmentic\" --trace=Debug" -output:OpenCoverOutput.xml

The command detects only tests from the "Geometry" namespace and tests from "Arithmetic" namespace are not detected at all.

Need help on running tests from multiple namespace using the --Where option

Have tried with || and && in the where condition for the namespaces

Have tried with OR and and in the where condition for the namespaces

No Luck so far.

Any help would be appreciated

After some experimentation I found that the following command worked

"D:\DEVOPS_TOOLSET\opencover.4.5.3427\OpenCover.Console.exe" -filter:"+[Project.AcceptanceTests]Project.AcceptanceTests.Geometry,Project.AcceptanceTests.Arithmentic  -[nunit*]*" -target:"D:\DEVOPS_TOOLSET\NUnit.ConsoleRunner.3.11.1\tools\nunit3-console.exe" -targetargs:"Project.AcceptanceTests\bin\Release\Project.AcceptanceTests.dll --framework:net-4.5 --result:UnitTestResults.xml --labels=Before --where \"namespace == ^'Project.AcceptanceTests.Geometry^' OR namespace == ^'Project.AcceptanceTests.Arithmentic^'\" --trace=Debug" -output:OpenCoverOutput.xml

This link helped me to resolve the issue Run all tests in namespace using Nunit3-console.exe

Also verified that selected namespaces has proper test fixtures available

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM