首页 > 解决方案 > Specflow - 场景大纲测试被忽略

问题描述

我正在使用 Selenium 和 Specflow 开发测试自动化,但是当我尝试运行我的 Scenario Outline 时,它​​被完全忽略了。

我已经尝试调试它并且没有执行任何步骤,我不知道为什么。
常见场景工作得很好。

我在 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" />

标签: c#msbuildautomated-testsnunitspecflow

解决方案


您的功能文件中有问题。

@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 并重试


推荐阅读