首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Nunit3-Console.exe运行specflow测试,但仅检测来自一个命名空间的测试

使用Nunit3-Console.exe运行specflow测试,但仅检测来自一个命名空间的测试
EN

Stack Overflow用户
提问于 2020-05-04 17:33:00
回答 1查看 166关注 0票数 0

构建环境

项目语言: C#

.net框架4.5

OpenCover版本2.5.3427

Specflow版本2.3

Nunit版本3.11.0

要求

在构建期间,用户将选择多个子系统验收测试,我需要为这些子系统运行测试。所有测试都在相同的程序集中,但由文件夹(命名空间)分隔

我正在运行以下命令

代码语言:javascript
复制
"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

该命令只检测来自"Geometry“命名空间的测试,而不检测来自"Arithmetic”命名空间的测试。

需要有关使用--Where选项从多个命名空间运行测试的帮助

我尝试过在命名空间的where条件中使用||&&

我尝试过在命名空间的where条件中使用ORand

到目前为止还不走运。

任何帮助都将不胜感激

EN

回答 1

Stack Overflow用户

发布于 2020-05-04 20:17:22

经过一些实验后,我发现以下命令可以工作

代码语言:javascript
复制
"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

此链接帮助我解决了Run all tests in namespace using Nunit3-console.exe问题

还验证了选定的命名空间是否有适当的测试fixture可用

谢谢

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61589102

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档