如何解决如何使用vstest.console.exe在cmd中运行Specflow功能/方案?
我有一个类似的特征文件
Feature: Portal Sign in
In order to login to my portal
As a User
I have input user id and password
Scenario: User Login
Given I have entered username and password
When The user clicks on Login button
Then logged in successfully pop up message should be displayed
我尝试了此cmd:
vstest.console.exe tests.dll /TestCaseFilter:"FullyQualifiedName~PortalSigninFeature"
,但对于给定的测试用例过滤器,它不返回任何测试匹配项。我想念什么吗?
您还建议如何使用cmd运行方案?
编辑:
如果发生以下情况,请概述“大纲”
Scenario Outline: Multiple User Login
Given I have entered <username> and <password>
When The user clicks on Login button
Then logged in successfully pop up message should be displayed
Examples:
|username|password|
|User1 |pwd1 |
|User2 |pwd2 |
当我运行下面的cmd
SpecRun.exe run D:\SpecFlow\bin\Debug\MySpecFlowTests.dll --filter testpath:"Scenario:Multiple+User+Login"
发现的测试显示为0。
我应该进行任何更改以使其适用于方案大纲吗?
解决方法
当我从命令行在jenkins中运行此程序时,我得到了以下内容。我正在为跑步者使用SpecRun。这确实需要一个RunSettings文件。
cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow" vstest.console.exe /settings:E\MyPath\To\RunSettings\ E:\MyPathTo\Test.dll /ResultsDirectory:E:\MyPath\ /TestCaseFilter: "(TestCategory=MyTag)"
我创建了一个名为Jenkins的文件夹,RunSettings和.srprofile都驻留在该文件夹中。
RunSettings文件指向.srprofile
<RunSettings>
<!-- Configurations for SpecFlow+ Runner -->
<SpecRun>
<Profile>Jenkins/MyTest.srprofile</Profile>
<GenerateSpecRunTrait>false</GenerateSpecRunTrait>
<GenerateFeatureTrait>false</GenerateFeatureTrait>
</SpecRun>
</RunSettings>
如果将SpecRun用作运行程序,则也可以从cmd行运行它。相应地更新亚军版本。
cd E:\Path\to\packages\SpecRun.Runner.3.3.*\tools\net461
SpecRun.exe run PathTo/My.srprofile --baseFolder E:\Path\To\bin\Debug --filter "@TagL" --log specrun.log
要通过功能名称运行,您将使用:
SpecRun.exe run D:\Path\Jenkins\My.srprofile --baseFolder D:\Path\bin\Debug --filter testpath:"Feature:MyFeature*" --log specrun.log
通配符将匹配以“ MyFeature”开头的所有内容。
https://docs.specflow.org/projects/specflow-runner/en/latest/Profile/Filter.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。