Forum Discussion
nmrao
Champion Level 3
Not really how you saved the cookie? test case level? suite level?
Is the same cookie to be used for all the steps spread across test cases and suites?
Is the same cookie to be used for all the steps spread across test cases and suites?
Tush
7 years agoOccasional Contributor
In 'Lib' testsuite, we extract and save the session ID to a variable using groovy script.
Then I add header parameter named 'cookie' to all my API requests and pass the variable value.
I am able to execute my tests this way.
Issue: I have to update my API's everyday. While I do this I need to keep adding Header parameter to all my API's,which is a gruesome process.
yes,I need to use the same cookie across all the test cases and test Suits.
- nmrao7 years agoChampion Level 3Can you show the script which does that?
- Tush7 years agoOccasional Contributor
After running "Login" test case, I extract the session ID from the Login response header.
def harResponse = context.expand( '${#[Lib#startSession#login]#HarResponse#$[\'headers\'][7][\'value\']}' )
I then pass this value to cookie parameter in my API requests.
- nmrao7 years agoChampion Level 3I was saying to persist it at suite level / project level (so that all suites can use this).
Use this project level value in the Events to set a cookie.
Related Content
- 7 months agosohailalam2696