[英]How to compare 2 JSON objects that contains array using Karate tool and feature files
[英]Not able to run the feature files written in karate as a cucumber feature in eclipse
我安裝了黃瓜 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();
});
你可能有錯誤的 Cucumber Eclipse 插件或者你需要做一些小的配置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.