Reputation: 1
I wonder if there is a way somehow to specify the load (nbr of virtual users) per call and not per scenario?
Let's say I want to stress test a game and I only need one call to open or close a game, but I want a huge deal of users playing it... Can I achieve this with Gatling?
Thanks a lot!
Upvotes: 0
Views: 552
Reputation: 1736
One way to do it:
Steps:
Wrap your Simulation in a trait.
Define methods within the trait.
Define the scenarios.
After the closing brace of the trait, define a simulation class.
In the end you should have something like this:
package [name]
import [all the stuff]
trait Scenario2 extends Simulation {
//
// Here you should put all the VALs, baseURL, headers etc.
//
def openGame() =
http("Opens the game")
.get("IP to open the game")
.headers(headers)
.check(status.is(200)) (optional)
def usersPlaying() =
http("Users playing the game")
.get("IP to play the game")
.headers(headers)
.check(status.is(200)) (optional)
def scen(name: String) = {
scenario(name)
.exec(openGame())
}
def scen2(name: String) = {
scenario(name)
.exec(usersPlaying())
.pause(5) // the pause needs to be **here** for some reason, rather than in *scen*
}
}
// Here lies the simulation class
class Testing_The_Game extends Scenario2 {
setUp(
(scen("This opens the game")
.inject(
atOnceUsers(1))
.protocols(httpConf)),
(scen2("This simulates users playing")
.inject(
atOnceUsers(1000))
.protocols(httpConf))
)
}
Just found this answer. It looks much better than mine.
Upvotes: 0
Reputation: 8715
You can always have a small scenario doing exactly what you want. If you don't want to repeat certain steps for every single user, you may probably use before/after hooks to open or close game.
Upvotes: 1