Can Gatling fit this use-case

Hello, I’m new to Gatling but I find this tool really nice.

My use-case is a kind of ticket system :

  • A user posts a file (done with Gatling)
    The server gives this request an ID (response is a JSon data). ID is a kind of UUID so it’s not predictable (done with Gatling)
  • The user can “get datas” on his post using the ID (May be stuck here if I wan’t to test only this part)

I’d like to load test all the steps above.
But the upload part is done not so often whereas the “get datas” is much more used.

Scenarios:

  1. Scenario : all in one
    That scenario is easy to do (done with Gatling)

  2. Scenario : upload only
    That scenario is easy to do (done with Gatling)

  3. Scenario : only “get datas”
    WTF how can I get those UUID into a feeder ??

Question:
In an ideal life, I’d like to have a first simulation “warming” the system by doing either scenario 1 or 2.
Then a second simulation using the Id generated from the first simulation to do “intense” load test on scenario 3 (having scenario 2 running as well with less intense stress).

Is there a way to generate a file during the scenario 2?
(This file would store the ID fron the responses)
If so I would be able to run the scenario 3 “alone”.

Thank you for reading

Hi Sylvain,

Glad you want to give Gatling a chance :wink:

Simple answer:

Gatling fits your use case!

Yep, that’s it, it does :slight_smile:

More useful answer:

You can use checks to save values in the session of the user. You can then use these values like the ones of the feeder (the feeder puts its values in users sessions also).

You can read this to learn more about checks : https://github.com/excilys/gatling/wiki/Checks

Concerning your other question, it is possible, though it is a bit more complicated. You can use Session Functions ( https://github.com/excilys/gatling/wiki/Session#wiki-functions ) to export the value you saved to a file.

Cheers,
Romain

Hi there,

I’ll just complete what Romain said.

Trying to use the Feeder API for this is a common mistake: feeders are used to populate pre-generated data, such as login/passwords.

If you want to reuse a page output as the next page input, just like a normal user would browse a website, you have to use the Check API. You can use a regex, but also note that you can use a jsonpath for your JSON:
https://github.com/excilys/gatling/wiki/Checks#wiki-json

Regarding your wanting to log your UUIDs into a specific file, I’d personaly use a Session function, as Romain explained. I’d probably log with slf4j/logback in order to ensure thread-safety.

val logger = org.slf4j.LoggerFactory.getLogger(“foo”)

.exec((session: Session) => logger.debug(session.getAttribute(“uuid”))

Don’t forget to configure an appender for the foo logger.

Cheers,

Steph

2012/8/13 Romain Sertelon <bluepyth@gmail.com>