Skip to content

Instantly share code, notes, and snippets.

@aghuddleston
Last active January 3, 2016 11:29
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 aghuddleston/8456857 to your computer and use it in GitHub Desktop.
Save aghuddleston/8456857 to your computer and use it in GitHub Desktop.
A Gatling-tool test case that does create/update/delete on an object, using the session userId as part of the object id. Using gatling-1.5.3.
package mypackage
import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import com.excilys.ebi.gatling.http.Headers.Names._
import akka.util.duration._
import bootstrap._
object Department {
val departmentScn = scenario("Department CRUD")
.exec(
http("Create Department")
.get("/department/add")
.queryParam("parameters", (s:Session) => """[{"departmentName":"Perf Test Department","departmentCode":"PerfDept"""+s.userId.toString+"""","initiatorId":"MyIdHere"}]""")
.check(status.is(200))
)
.pause(0 milliseconds, 5 milliseconds)
.exec (
http("Update Department")
.get("/department/update")
.queryParam("parameters", (s:Session) => """[{"departmentName":"Update name","departmentCode":"PerfDept"""+s.userId.toString+"""","initiatorId":"MyIdHere"}]""")
.check(status.is(200))
)
.pause(0 milliseconds, 5 milliseconds)
.exec (
http("Delete Department")
.get("/department/delete")
.queryParam("parameters", (s:Session) => """[{"departmentCode":"PerfDept"""+s.userId.toString+"""","initiatorId":"MyIdHere"}]""")
.check(status.is(200))
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment