api - 无法在 Eclipse 中将 Karate 编写的功能文件作为 cucumber 功能运行

标签 api testing eclipse-plugin cucumber-jvm karate

我安装了 Cucumber Eclipse 插件。我已经用 Karate 编写了简单的功能文件,当我尝试将其作为 cucumber 测试运行时,我被要求实现缺少的步骤。当我使用专用运行程序运行相同的功能文件时,它执行时没有任何问题。请您帮忙解决这个问题。我正在尝试在不使用专用运行程序的情况下运行此测试

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();
});

最佳答案

您可能安装了错误的 Cucumber Eclipse 插件,或者需要进行一些小的配置。

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

关于api - 无法在 Eclipse 中将 Karate 编写的功能文件作为 cucumber 功能运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47145012/

相关文章:

python - 使用 GitHub API 检查用户是否存在

java - 在 Eclipse 插件开发中从 SWT UI 搜索类

java - 在 Eclipse 中重命名重构

javascript - REST API azure 语音转文本(已识别 : Text=undefined)

ruby - stub HTTP 请求的目的是什么(例如使用 WebMock gem)?

api - 开源音乐流API

spring - 使用 Spring Boot 1.4.1 和 H2 测试 JPA

javascript - 轻松模拟 Restful 服务的工具

testing - 在自动化脚本中比较两个 JSON 数据的更好方法

android - 未能加载属性文件...不再 :(