I am trying to modularize my code and have multiple simulations use a common external file they can call .exec blocks from. Is this something that Gatling can handle?
For example, I want simulations A and B to use a .exec I have defined on a separate file, possibly on a function.
Me doing it a lot in my tests. Basically, I’ve created a library containing most common things that can be performed in an app i’m testing, and then use it just like lego in actual test scenarios)
You can define something like this in a separate object (e.g. called TestSteps):
def createSession: ChainBuilder = {
//you can put one or several requests here, or requests groups or whatever
exec(
http(“Create User”)
.put(“blah”)
.headers(headers)
.check(status.is(200))
)
}
Then you call it somewhere in your scenario:
exec(TestSteps.createSession)