1
votes

I am using Gatling and am running into an issue implementing an integration test. The test I am running has two parts (scenarios):

The first part is a simple GET request to verify expected server responses. In this step, it returns a form's configuration ID as well as other properties of the form.

In the next step, I am hitting PUT route which updates various properties of this form's configuration for testing of this route and other functionality through the back ends of an application.

The issue with these steps is that after running the second step, if there are any forms saved under that configuration, it will clone a copy for security purposes and changes the ID. Long story short, the same ID does not persist from test to test.

My question is: Is there a way within Gatling to run SQL Queries to get values and store them and then pass them? OR is there a way to store a variable from the GET method and pass it in in the second scenario's PUT method. I know there is Gatling's .saveAs() method, but I believe the scope of this function is only scenario.

Please notify me for further clarification and details; thanks in advance.

2

2 Answers

1
votes

This answer: https://groups.google.com/forum/#!topic/gatling/bfpKd_9d6gk can probably be used to handle your use case.

1
votes

The Google group link only shows you how to share (&cache) data between different user-sessions.

If you are looking for sharing data between "scenarios" rather than "user sessions", you should check out Peter's answer: https://stackoverflow.com/a/43061278/1395126

It's the only information I can find on the internet today that really shows you how to share data between scenarios in Gatling.

IMHO, it's super important to look out for the line of "// Set it here" comment. This is THE secret about sharing data among scenarios. Without setting session attribute first or accessing the "CreateId" directly in another scenario could not work.