Last active
December 31, 2015 20:49
-
-
Save ludo1026/8042477 to your computer and use it in GitHub Desktop.
Gatling - Scénario - Books creation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.tuto.gatling | |
import io.gatling.core.Predef._ | |
import io.gatling.core.session.Expression | |
import io.gatling.http.Predef._ | |
import io.gatling.jdbc.Predef._ | |
import io.gatling.http.Headers.Names._ | |
import io.gatling.http.Headers.Values._ | |
import scala.concurrent.duration._ | |
import bootstrap._ | |
import assertions._ | |
class RecordedSimulation extends Simulation { | |
val httpProtocol = http | |
.baseURL("http://localhost:8080") | |
.acceptHeader("*/*") | |
.acceptEncodingHeader("gzip, deflate") | |
.acceptLanguageHeader("fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3") | |
.connection("keep-alive") | |
.userAgentHeader("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0") | |
val scn = scenario("Scenario Name") | |
.exec(http("Welcome") | |
.get("""/starterKitSpring/""")) | |
.pause(47 milliseconds) | |
.exec(http("Books list") | |
.get("""/starterKitSpring/book""")) | |
.pause(31 milliseconds) | |
.exec(http("Book creation") | |
.get("""/starterKitSpring/book/create""")) | |
.pause(50 seconds) | |
.exec(http("Book creation saved") | |
.post("""/starterKitSpring/book""") | |
.param("""_method""", """PUT""") | |
.param("""id""", """""") | |
.param("""availability""", """""") | |
.param("""bestSeller""", """""") | |
.param("""discount""", """""") | |
.param("""isbn""", """1""") | |
.param("""price""", """""") | |
.param("""quantity""", """""") | |
.param("""title""", """Book""") | |
.param("""publisher.code""", """1""") | |
.param("""author.id""", """3""")) | |
setUp(scn.inject(constantRate(20 usersPerSec) during (3 minutes))).protocols(httpProtocol) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment