You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm profiling an api, and I need to call my login page which return a token I need to pass to all my next calls.
Currently, to do this, I call /login, then set token json('token') and use that token in my header of the next requests in the same scenario. The issue is that I need that token for all my scenarios, so I have to login at the begining of each one.
That would be great to call only once the /login page and set my token as a variable available in all my next scenarios.
May be some code would be more explicit :
currenlty:
group login
visit url('/login')
header 'accept: "application/json"'
method 'POST'
body
"""
{
"username": "user",
"password": "pass"
}
"""
expect status_code() == 200
set token json('token')
scenario
name "Feature 1"
include login
visit url('/feature-1')
header 'content-type: "application/json"'
header 'X-TOKEN: ' ~ token
expect status_code() == 200
scenario
name "Feature 2"
include login
visit url('/feature-2')
header 'content-type: "application/json"'
header 'X-TOKEN: ' ~ token
expect status_code() == 200
include login is repeated and increase the time of the whole blackfire profile.
Most of the testing framework has some hooks to stick before / after scenarios. What do you think about something similar that are not executed concurently? For example:
Hi,
Let me explain :)
I'm profiling an api, and I need to call my login page which return a token I need to pass to all my next calls.
Currently, to do this, I call
/login
, thenset token json('token')
and use thattoken
in my header of the next requests in the same scenario. The issue is that I need that token for all my scenarios, so I have to login at the begining of each one.That would be great to call only once the
/login
page and set mytoken
as a variable available in all my next scenarios.May be some code would be more explicit :
currenlty:
include login
is repeated and increase the time of the whole blackfire profile.What would be great:
What do you think ?
The text was updated successfully, but these errors were encountered: