question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use response body in the next senario

See original GitHub issue

If I have a scenario like this:

Scenario: get a list of all categories
  When method get
  Then status 200
  And match response == '#array'
! And def first = response[0]    <-- Define the first element of the response array as 'first'

Scenario: get details about the first category
  Given path first.id
  When status 200
  And match response == read('firstCategory.json')

Questions:

  1. Is something possible
  2. If yes, how 😃 ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hydroid7commented, Jun 29, 2017

@ptrthomas thank you very much, it works now, but I have to put the preparation scenario in an other feature. 👍

To summarize, there are 2 different way:

  1. To make one big scenario or
  2. To put the init part in a extra feature

I’m thinking about such a tag, like #karate-test or #karate-rest-test, or simply #karate.

Thanks for your help and for the amazing framework 😃

0reactions
ptrthomascommented, Jun 29, 2017

Great ! BTW I was thinking of the tag name as #karate-dsl

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using response data from one scenario to another
Make a GET request to specific data; Store a value as a def variable; Use that information for a separate scenario. This is...
Read more >
How to Read Json Response Body using Rest Assured?
Using these methods we can get an Object of type io.restassured.response.ResponseBody. This class represents the Body of a received Response.
Read more >
Extracting Data from Responses and Chaining Requests
You're getting the response as a string in `responseBody` variable and it is not attached to the document for you to be able...
Read more >
how to log entire response (at least statusCode & body) #650
I'm trying to correlate the response statusCode with the response body. How can I get a log of the body & the statusCode?...
Read more >
Simulating Stateful Behavior for Testing - WireMock
Stub mappings can be configured to match on scenario state, such that stub A can be returned initially, then stub B once the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found