当前位置: 首页 > 知识库问答 >
问题:

无法在eclipse中运行以空手道编写的功能文件作为cucumber功能

施洛城
2023-03-14

我已经安装了cucumber eclipse插件。我已经用空手道编写了我的简单功能文件,当我试图将其作为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();
});

共有1个答案

施慈
2023-03-14

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

请参考留档的这一节:cucumberIDE支持故障排除

 类似资料:
  • 我需要一些帮助运行一个功能文件。 这是Maven项目的骨架: 这是我的pom.xml文件: 我不能运行功能文件,与此,我不能运行任何与cucumber相关的。你能帮帮我吗? 提前谢了。

  • 我希望只通过代码通过空手道UI运行多个功能文件。空手道UI提供了一个又一个执行cucumber特性文件的特性,但我希望通过代码打开UI,使用但在那里我不能使用三个参数。 如果我放置多个,然后它只拾取第一个feature1文件。

  • 我的功能文件如下 end2end_test.feature 我的runner.java文件如下所示 testRunner.java

  • 我正在使用Maven SureFire,TestNG(扩展AbstractTestNGCucumber测试)和Cucumber,并且有几个功能文件,每个文件都有几个场景。我希望能够在一个功能文件中并行运行每个场景,但一次只能运行一个功能文件。这有可能吗? 举个例子: 我希望场景1a、1b和1c在功能文件1中并行运行。一旦这些完成,运行场景2a和功能2等的2b。 这是当前一次从所有功能文件运行所有方

  • 如何在gatling模拟中运行多个空手道功能文件? 以下是我gatling模拟的代码片段: 我每次只能运行一个功能文件,如下所示:

  • 我的API测试项目的工作,并已纳入空手道这样做。现在,我的要求是创建一个响应endpoint的服务器。所有这些都已完成,但我的要求是访问服务器功能中的空手道配置文件中定义的变量。我不能这样做。 例如:功能:示例服务器 场景:路径匹配('\variablevalue)**methodIs('get')) def响应=默认环境 注意:默认_env是空手道配置中的一个变量。js文件,并保存一些默认值。