Hey guys,
I’m new to gatling and Scala, so I apologize in advance if this is an obvious answer. We have a very complex system we’re testing, and I’m breaking down operations into objects that encapsulate the behaviors so that we can re-use them. We’re then re-using these behaviors by chaining the executions together in out test scenarios. I have the following basic steps.
- Register
- Login, which returns an oAuth token
- Create an application, using the oAuth token from 2 in the header.
I have 1 and 2 working, and my token stored in the session.
Here’s my file for 1)
https://gist.github.com/tnine/58697c66cd336b3ae657#file-createorgadmin-scala
Here’s my file for 2)
https://gist.github.com/tnine/58697c66cd336b3ae657#file-gettoken-scala
Here’s my file for 3, with the Headers utility object
https://gist.github.com/tnine/58697c66cd336b3ae657#file-createapplication-scala
https://gist.github.com/tnine/58697c66cd336b3ae657#file-headers-scala
What’s not clear to me is how to test the current session for the presence of the value “accessToken” and add it to the headers map. I may be doing this incorrectly as well. Is there a more conventional way for me to accomplish this?
Thanks in advance,
Todd