【问题标题】:Cucumber scenario outline with examples: Failed to create scenario runner带有示例的 Cucumber 场景大纲:无法创建场景运行器
【发布时间】:2016-12-07 22:38:14
【问题描述】:

我开始从事测试自动化工作,目前我遇到了一个小问题。

我制作了小黄瓜场景:

Feature: Post Draft

  Scenario: Successful Login with Valid Credentials
    Given User go to Admin Page
    Then User enters UserName and Password

  Scenario Outline: Successful creation post draft
    Given User navigate to pages list
    Then User open page with ID <postsIds> for editing
    Then User navigate to Advertising tab
    Then User check custom ads code radio button
    And Insert custom advertising code
    Then User save post
    And See that custom ads code is appears

    Examples:
      | postsIds |
      | 61591    |
      | 62231    |
      | 61827    |
      | 63300    |
      | 62023    |
      | 62231    |

当我尝试执行这个场景时,我得到了错误:

cucumber.runtime.CucumberException: Failed to create scenario runner
    ... 21 more

有人有同样的问题吗?我不知道是什么问题,因为如果我删除大纲关键字和示例列表,测试正在运行...

我实现了所有步骤,没有大纲也可以工作,但是我有很多值,我不想为每个值实现步骤,这就是为什么我需要使用场景大纲

请帮我解决这个问题。

【问题讨论】:

    标签: java testing junit cucumber


    【解决方案1】:

    我发现了问题。我将 cucumber-junit 包更新到最新版本,它没有向后兼容。

    这是 Maven 依赖项,它有效:

    <dependencies>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-picocontainer</artifactId>
            <version>1.1.8</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>1.1.8</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>2.42.2</version>
        </dependency>
    </dependencies>
    

    GHERKIN: SCENARIO OUTLINES

    我还有一篇文章Cucumber testing guide

    【讨论】:

    • 酷!非常感谢您的帮助!
    • 似乎 cucumber 2.x 已移至 io.cucumber 组。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-12
    • 1970-01-01
    • 2018-07-21
    • 1970-01-01
    相关资源
    最近更新 更多