Огурец - Схема сценария - Когда я использую строку сценария для параметризации данных, после запуска выдается ошибка, и все шаги пропускаются - PullRequest
0 голосов
/ 23 октября 2019

Ниже приведен сценарий огурца, в котором шаги 1, 2, 4, 5, 6, 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)

Я не знаю, в чем проблема, может кто-нибудь мне помочь.

...