Reputation: 31
I use the script below to test my server with various clients.
package test
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
class Lasttest_ThinClient extends Simulation {
val httpProtocol = http
.baseUrl("http://localhost:8080")
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.doNotTrackHeader("1")
.acceptLanguageHeader("en-US,en;q=0.5")
.acceptEncodingHeader("gzip, deflate")
.userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")
val scn = scenario("Lasttest: Thin Client (X Clients)")
.exec(
http("UC-0")
.get("/movingAverage/50/abbn")
)
.pause(1,3)
.exec(
http("UC-1")
.get("/getBestValue")
.queryParam("min", "2")
.queryParam("max", "250")
.queryParam("name", "abbn")
)
.pause(1,3)
.exec(
http("UC-2")
.get("/getBestValueOneYear")
.queryParam("min", "2")
.queryParam("max", "250")
.queryParam("name", "abbn")
)
.pause(1,3)
.exec(
http("UC-3")
.get("/bestSimpleAveragePortfolio")
)
.pause(1,3)
.exec(
http("UC-5")
.get("/buyHoldPortfolio")
)
.pause(1,3)
.exec(
http("UC-6")
.get("/getBestStrategy")
)
.pause(1,3)
.exec(
http("UC-7")
.get("/getBestStrategyOneYear")
)
setUp(
scn.inject(
atOnceUsers(3),
).protocols(httpProtocol)
)
}
Is there a possibility to randomize the way the use cases get runned. so that every client picks per example 3 out of the 7 use cases randomly. would be nice to create a Practice-oriented scenario instead of simply executing all use cases in sequence.
Upvotes: 0
Views: 419
Reputation: 6608
There are several tools you can use to introduce randomness in your Gatling tests, eg:
randomSwitch
randomSwitch
is probably what you want to use here.
Upvotes: 1