Skip to content

Instantly share code, notes, and snippets.

@abruzzi
Created March 17, 2014 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abruzzi/9598017 to your computer and use it in GitHub Desktop.
Save abruzzi/9598017 to your computer and use it in GitHub Desktop.
package jmeter
import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import com.excilys.ebi.gatling.http.Headers.Names._
import bootstrap._
class JMeterBenchmark extends Simulation {
val httpConf = httpConfig
.baseURL("http://localhost:8080/examples/servlets")
.acceptCharsetHeader("ISO-8859-1,utf-8;q=0.7,*;q=0.7")
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.acceptEncodingHeader("gzip, deflate")
.acceptLanguageHeader("fr,fr")
.userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0.1) Gecko/20100101 Firefox/8.0.1")
val scn = scenario("JMeter Benckmark with Gatling")
.repeat(30) {
exec(http("sessionExample1")
.get("/servlet/SessionExample")
.check(status.is(200)))
.pause(5)
.exec(http("sessionExample2Post")
.post("/servlet/SessionExample")
.param("dataname", "TOTO")
.param("datavalue", "TITI")
.header(CONTENT_TYPE, "application/x-www-form-urlencoded")
.check(status.is(200)))
.pause(5)
.exec(http("index")
.get("/index.html")
.check(status.is(200)))
.pause(5)
.exec(http("sessionExample3")
.get("/servlet/SessionExample")
.check(status.is(200)))
.pause(5) //
}
setUp(scn.users(1500).ramp(100).delay(7).protocolConfig(httpConf))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment