The document describes setting initial variables from a REST API response. It makes a GET request to a URL to get location data, then uses JSON paths to extract specific values from the response and save them to story variables. These include the number of locations returned, a list of locations, and individual location names. The values are used in examples to demonstrate retrieving multiple location names from the response.
The document describes setting initial variables from a REST API response. It makes a GET request to a URL to get location data, then uses JSON paths to extract specific values from the response and save them to story variables. These include the number of locations returned, a list of locations, and individual location names. The values are used in examples to demonstrate retrieving multiple location names from the response.
The document describes setting initial variables from a REST API response. It makes a GET request to a URL to get location data, then uses JSON paths to extract specific values from the response and save them to story variables. These include the number of locations returned, a list of locations, and individual location names. The values are used in examples to demonstrate retrieving multiple location names from the response.
When I get access token as admin When I get index of random active element from URL '${main-page-url}/v1/1/filters/staffingLocationFilter/parameters/location/values? unitType=PROJECT' by the JSON path '<initialBodyOfJsonPath>' and save it to STORY variable '<numberOfLocationCity>NumberOfLocationName' When I save JSON element from context by JSON path `<initialBodyOfJsonPath>` to STORY variable `<numberOfLocationCity>ListOfLocationNames` When I save a JSON element from '${<numberOfLocationCity>ListOfLocationNames}' by JSON path '$.[${<numberOfLocationCity>NumberOfLocationName}]' to STORY variable '<numberOfLocationCity>LocationNameWithQuotes' When I initialize the STORY variable `<numberOfLocationCity>LocationName` with value `#{removeWrappingDoubleQuotes($ {<numberOfLocationCity>LocationNameWithQuotes})}` Examples: |numberOfLocationCity|initialBodyOfJsonPath | |first |$..values[?(@.label == 'APAC')]..children..children..label | |second |$..values[?(@.label == 'APAC')]..children..children[?(@.label != '${firstLocationName}')]..label | |third |$..values[?(@.label == 'APAC')]..children..children[?(@.label != '${firstLocationName}' && @.label != '${secondLocationName}')]..label | |fourth |$..values[?(@.label == 'APAC')]..children..children[?(@.label != '${firstLocationName}' && @.label != '${secondLocationName}' && @.label != '$ {thirdLocationName}')]..label | |fifth |$..values[?(@.label == 'APAC')]..children..children[?(@.label != '${firstLocationName}' && @.label != '${secondLocationName}' && @.label != '$ {thirdLocationName}' && @.label !='${fourthLocationName}')]..label|
Scenario: Set innitial variables
When I get access token as admin When I set headers with token When I issue a HTTP GET request for a resource with the URL '${main-page-url}/v1/1/filters/staffingLocationFilter/parameters/location/values? unitType=PROJECT' Then the response code is equal to '200' When I save JSON element from context by JSON path `<initialBodyOfJsonPath>` to STORY variable `<numberOfLocationCity>ListOfLocationNames` When I save a JSON element from '${<numberOfLocationCity>ListOfLocationNames}' by JSON path '$.[<numberOfLocationName>]' to STORY variable '<numberOfLocationCity>LocationNameWithQuotes' When I initialize the STORY variable `<numberOfLocationCity>LocationName` with value `#{removeWrappingDoubleQuotes($ {<numberOfLocationCity>LocationNameWithQuotes})}` Examples: |numberOfLocationCity|initialBodyOfJsonPath |numberOfLocationName| |first |$..values[?(@.label == 'WE')]..children..[?(@.label == 'Spain')]..label |4 | |second |$..values[?(@.label == 'WE')]..children..[?(@.label == 'France')]..label |1 | |third |$..values[?(@.label == 'WE')]..children..[?(@.label == 'Netherlands')]..label|1 | |fourth |$..values[?(@.label == 'WE')]..children..[?(@.label == 'Ireland')]..label |1 | |fifth |$..values[?(@.label == 'WE')]..children..[?(@.label == 'Switzerland')]..label|8 |