【问题标题】:Specflow custom tool error when adding "Examples:"添加“示例:”时,specflow自定义工具错误
【发布时间】:2016-09-07 04:39:52
【问题描述】:

我有这个规范:

Feature: Homepage
    As a webiste user
    I want to see a pretty homepage

Scenario: Homepage Display
    Given I am on an ecommerce <website>
    When I look at the content
    Then I should see a swiper

Examples: 
| Description | website             |
| Local       | localhost:9000      |
| Development | dev.mysite.com      |

但 Visual Studio 2015 不会构建它说:

自定义工具错误:(10:1):预期:#EOF、#TableRow、#DocStringSeparator、#StepLine、#TagLine、#ScenarioLine、#ScenarioOutlineLine、#Comment、#Empty,得到“示例:”

如果我删除 Examples: 就可以了。

据我所知,规范看起来是正确的语法,但我昨天才开始探索这个,所以我可能犯了一个基本错误。我可以在场景上右键生成步骤代码OK,看起来都很合理。

我正在使用,来自 NuGet

  • SpecFlow 2.0.0
  • SpecFlow.MsTest 2.0.0

以及来自扩展和更新

  • SpecFlow for Visual Studio 2015,版本 2015.1.2

我使用“单元测试项目”,框架 4.5.1 来创建我的项目。


我做错了什么?

【问题讨论】:

    标签: visual-studio-2015 specflow


    【解决方案1】:

    示例只能与场景大纲一起使用。场景大纲是使用不同数据集运行场景的方法。

    如果您将 Scenario 更改为 Scenario Outline 您的示例将起作用:

    Feature: Homepage
        As a webiste user
        I want to see a pretty homepage
    
    Scenario Outline: Homepage Display
        Given I am on an ecommerce <website>
        When I look at the content
        Then I should see a swiper
    
    Examples: 
    | Description | website             |
    | Local       | localhost:9000      |
    | Development | dev.mysite.com      |
    

    GitHub Cucumber 页面对 Scenario Outlines 有很好的解释: https://github.com/cucumber/cucumber/wiki/Scenario-outlines

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-11
      • 2012-10-21
      • 1970-01-01
      • 1970-01-01
      • 2020-05-06
      • 1970-01-01
      • 1970-01-01
      • 2016-10-12
      相关资源
      最近更新 更多