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

passing variable between scenarios #29

Open
jagarcad opened this issue Aug 20, 2018 · 2 comments
Open

passing variable between scenarios #29

jagarcad opened this issue Aug 20, 2018 · 2 comments

Comments

@jagarcad
Copy link

HI,

I am using your tool to test a rest API and needs to pass variable from one scenario to another.

In the first one I do a POST request to create an item and in second scenario later on I try to delete the created item.
For that I use you grab fuction in the first scenarion and try to use it in the second but does not seem to work. It seems the scope of a variable is a scenario. Do you have a work around to pass variables ?

I tried to group everything into one scenario but got errors message on headers.

And I send a POST request to "http://192.168.99.100:5252/data/application"
Then the response status should be "200"
And I grab "$.application.id" as "id"
Then I send a DELETE request to "http://192.168.99.100:5252/data/application/{id}"

<title>Error 401</title>

Unauthorized (401)

doing the same request on a different scenario work. The headers are declare by:
Given I send "x-www-form-urlencoded" and accept JSON
And I add Headers:
| Cache-Control | no-cache |
|authorization | Basic XXXXXXXXX |

Thanks for your help

@biggianteye
Copy link
Contributor

If you do more than one HTTP request in a scenario, any headers you set on the first request are not inherited in subsequent requests. This is why you are getting a 401 when you make the DELETE request. You need to set the Authorization header again.

@jagarcad
Copy link
Author

thanks for you reply.

I will do it that way I guess. It would be great if could use the background steps information in any request we do later on. Right now we can only use it for the first request of a scenario which is really great by the way.

Thanks for your help, I like you tool, makes life easier :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants