下面是黄瓜方案,其中步骤1、2、4、5、6从其他功能中选取时工作正常 文件,但是第3和第7步出现了问题。
@Api
Scenario Outline: Getting Primary category count from Solr
Given User should have the base url for search vehicle
When User passes items per page as "20"
And User passes facet region as "US" and primarycategory type as "<Primary Category>"
And User fetches records with "/api/vehicles" endpoint
Then User should get status code "200" in response
And User should get 20 vehicles records in the response
Then User should get "<Primary Category>" count as "<Category Count>" in the response
Examples:
| Primary Category | Category Count |
| truck | 2125 |
| Tractor | 2366 |
| Trailer | 530 |
| Specialized | 0 |
| Reclassified | 0 |
下面是我的代码
@And("^User passes facet region as \"([^\"]*)\" and primarycategory type as \"([^\"]*)\" $")
public void user_passes_facet_region_as_and_primarycategory_type_as(String region, String primary_category) {
httpRequest.queryParam("facets", "r="+region+";g="+primary_category).urlEncodingEnabled(true);
}
@Then("User should get \"([^\"]*)\" count as \"([^\"]*)\" in the response$")
public void user_should_get_primary_category_count_as_in_the_response(int int1) {
int cat_count = response.jsonPath().get("Data.Count");
Assert.assertEquals(cat_count,int1);
}
After run i am getting the below error on console
@Api
Scenario Outline: Getting Primary category count from Solr # featurefile/PrimaryCategoryCount_From_Solr_API.feature:16
Given User should have the base url for search vehicle # FacetsSearchAPISteps.user_should_have_the_base_url_for_search_vehicle()
When User passes items per page as "20" # FacetsSearchAPISteps.user_passes_items_per_page_as(String)
And User passes facet region as "US" and primarycategory type as "truck" # null
And User fectches records with "/api/vehicles" endpoint # FacetsSearchAPISteps.user_fectches_records_with_endpoint(String)
Then User should get status code "200" in response # FacetsSearchAPISteps.i_should_get_status_code_in_response(String)
And User should get 20 vehicles records in the response # FacetsSearchAPISteps.user_should_get_vehicles_records_in_the_response(int)
Then User should get "truck" count as "2125" in the response # PrimaryCategoryCount_From_Solr_API_Steps.user_should_get_primary_category_count_as_in_the_response(int)
我不知道这个问题在哪里可以帮助我。