0

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

Ganapatsa
  • 21
  • 4
  • Update: The namespaces "Geometry" and "Arithmetic" has individual classes that contain the test fixtures – Ganapatsa May 04 '20 at 10:29

1 Answers1

0

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

Ganapatsa
  • 21
  • 4