【问题标题】:Not able to run the feature files written in karate as a cucumber feature in eclipse无法将用空手道编写的功能文件作为 eclipse 中的黄瓜功能运行
【发布时间】:2017-11-06 20:16:15
【问题描述】:

我已经安装了我的黄瓜 Eclipse 插件。我已经用空手道编写了我的简单功能文件,当我尝试将其作为黄瓜测试运行时,我被要求实施缺少的步骤。当我使用专用运行器运行相同的功能文件时,它可以毫无问题地执行。请求您对此提供帮助。我正在尝试在不使用专用运行器的情况下运行此测试

Scenario: Validate that the sample webservice is up and running
Given url sampleUrl
When method get
Then status 200

Scenario: Validate a Json key value pair from the received response
Given url sampleUrl
When method get
Then status 200
And match $.RestResponse.result contains {name: 'United States of America', alpha2_code: 'US', alpha3_code: 'USA' }

*** Console output
Feature: Test a sample RESTFUL webservice
15:05:10.725 INFO  - Starting scenario: Validate that the sample webservice is up and running
15:05:10.725 INFO  - Ending scenario: Validate that the sample webservice is up and running
15:05:10.741 INFO  - Starting scenario: Validate a Json key value pair from the received response

  #Test Scenarios
  Scenario: Validate that the sample webservice is up and running # C:/Users/sxs8680/git/BDDCucumberJVM/src/test/java/com/thd/common/karatesupport/karatesample.feature:6
    Given url sampleUrl
    When method get
    Then status 200
15:05:10.741 INFO  - Ending scenario: Validate a Json key value pair from the received response

  Scenario: Validate a Json key value pair from the received response                                                   # C:/Users/sxs8680/git/BDDCucumberJVM/src/test/java/com/thd/common/karatesupport/karatesample.feature:11
    Given url sampleUrl
    When method get
    Then status 200
    And match $.RestResponse.result contains {name: 'United States of America', alpha2_code: 'US', alpha3_code: 'USA' }

2 Scenarios (2 undefined)
7 Steps (7 undefined)
0m0.006s


You can implement missing steps with the snippets below:

Given("^url sampleUrl$", () -> {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
});

When("^method get$", () -> {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
});

Then("^status (\\d+)$", (Integer arg1) -> {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
});

Then("^match \\$\\.RestResponse\\.result contains {name: 'United States of America', alpha(\\d+)_code: 'US', alpha(\\d+)_code: 'USA' }$", (Integer arg1, Integer arg2) -> {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
});

【问题讨论】:

    标签: api testing eclipse-plugin cucumber-jvm karate


    【解决方案1】:

    你可能有错误的 Cucumber Eclipse 插件或者你需要做一些小的配置。

    请参阅文档的这一部分:Troubleshooting Cucumber IDE support

    【讨论】:

    • 非常感谢彼得。安装正确的插件并删除我在项目中的一些依赖项已经解决了这个问题。
    猜你喜欢
    • 1970-01-01
    • 2019-01-29
    • 2017-07-12
    • 2022-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-04
    • 1970-01-01
    相关资源
    最近更新 更多