Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API testing: add ability to store specific named values from json responses #487

Open
sampacos opened this issue Feb 2, 2023 · 0 comments · May be fixed by #544
Open

API testing: add ability to store specific named values from json responses #487

sampacos opened this issue Feb 2, 2023 · 0 comments · May be fixed by #544
Labels
enhancement New feature or request

Comments

@sampacos
Copy link
Collaborator

sampacos commented Feb 2, 2023

It would be very helpful to be able to store specific portions of web responses in order to use in subsequent requests. For example

  • Send request to serviceX/api/v1/getUserByName?name=sampacos
  • serviceX responds with json such as
{
  "userId": "1245235",
  "name": "sampacos",
  "age": "45",
  "userPreferences": {
    "autoSave": "true"
    "sessionId": "12344123123"
  }
}
  • Send request to serviceY/api/v1/getProjectsByUserId?userId=1245235&sessionId=12344123123

What we need is the ability to store values from specific fields in the json to use for later requests.
In Gherkin, this might look something like this:

Given I use the API named ServiceX
When I add a parameter name with value sampacos
  And I send a GET request to the api/v1/getUserByName endpoint
Then I verify the response code is 200
  And I note the userId in the response
  And I note the userPreferences.sessionId in the response
When I use the API named ServiceY
When I add a parameter userId with the noted value
  And I add a parameter sessionId with the noted value
  And I send a GET request to the api/v1/getProjectsByUserId endpoint
Then I verify the response code is 200
@sampacos sampacos added the enhancement New feature or request label Feb 2, 2023
@david-ondrus david-ondrus linked a pull request Apr 28, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant