Specflow-方案大纲测试被忽略

时间:2019-11-14 17:52:27

标签: c# msbuild automated-tests nunit specflow

我正在使用Selenium和Specflow开发测试自动化,但是当我尝试运行我的方案大纲时,它会被完全忽略。

我已经尝试调试它,并且的步骤已执行,我也不知道为什么。
常见方案工作正常。

我正在Visual Studio Code中使用.NET Core 2.2。我当前的测试Runner是NUnit版本3.12.0,我的Specflow版本是3.0.225。
常规方案没有显示出任何此类问题。

@FilterScenario
Scenario Outline: Validating filter box and grid results
    Given I accessed the screen
    And the filter box is on
    When I select the groups <TypeGroup1>, <TypeGroup2>, <TypeGroup3>
    And select the teams <TypeTeam1>, <TypeTeam2>, <TypeTeam3>
    And click the Apply button
    Then the grid should show me only results that match groups <TypeGroup1>, <TypeGroup2>, <TypeGroup3> and teams <TypeTeam1>, <TypeTeam2>, <TypeTeam3>

    Examples:
    | TypeGroup1 | TypeGroup2 | TypeGroup3 | TypeTeam1  | TypeTeam2  | TypeTeam3  |
    | Type 1     |            |            | Type 1     |            |            | 
    | Type 1     | Type 2     | Type 3     | Type 1     | Type 2     | Type 3     |
    |            |            |            | Type 1     |            |            | 



我的项目中包含的软件包:

    <PackageReference Include="Microsoft.Extensions.Configuration" Version="3.0.0" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
    <PackageReference Include="nunit" Version="3.12.0" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
    <PackageReference Include="Selenium.Support" Version="3.141.0" />
    <PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
    <PackageReference Include="Specflow" Version="3.0.225" />
    <PackageReference Include="Specflow.Assist.Dynamic" Version="1.4.1" />
    <PackageReference Include="Specflow.NUnit" Version="3.0.225" />
    <PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.0.225" />

1 个答案:

答案 0 :(得分:0)

您的功能文件存在问题。

@FilterScenario
Scenario Outline: Validating filter box and grid results
    Given I accessed the screen
    And the filter box is on
    When I select the groups '<TypeGroup1>', '<TypeGroup2>', '<TypeGroup3>'
    And select the teams '<TypeTeam1>', '<TypeTeam2>', '<TypeTeam3>'
    And click the Apply button
    Then the grid should show me only results that match groups '<TypeGroup1>', '<TypeGroup2>', '<TypeGroup3>' and teams '<TypeTeam1>', '<TypeTeam2>', '<TypeTeam3>'

    Examples:
    | TypeGroup1 | TypeGroup2 | TypeGroup3 | TypeTeam1  | TypeTeam2  | TypeTeam3  |
    | Type 1     |            |            | Type 1     |            |            | 
    | Type 1     | Type 2     | Type 3     | Type 1     | Type 2     | Type 3     |
    |            |            |            | Type 1     |            |            |

重新生成stepdef,然后重试