Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
53 views1 page

Gatling CheatSheet

This document is a cheat sheet for Gatling Performance Testing using Scala DSL, outlining the basic structure of a simulation, including HTTP methods for GET, POST, PUT, and DELETE requests. It provides examples of setting up scenarios and configuring headers and body content for requests. The document serves as a quick reference for developers implementing performance tests with Gatling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views1 page

Gatling CheatSheet

This document is a cheat sheet for Gatling Performance Testing using Scala DSL, outlining the basic structure of a simulation, including HTTP methods for GET, POST, PUT, and DELETE requests. It provides examples of setting up scenarios and configuring headers and body content for requests. The document serves as a quick reference for developers implementing performance tests with Gatling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Gatling Performance Testing Cheat Sheet (Scala DSL)

1. Basic Structure
------------------
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._

class SimulationName extends Simulation {


val httpProtocol = http
.baseUrl("https://example.com")
.acceptHeader("application/json")

val scn = scenario("ScenarioName")


.exec(http("RequestName")
.get("/endpoint")
.check(status.is(200)))

setUp(
scn.inject(atOnceUsers(10))
).protocols(httpProtocol)
}

2. HTTP Methods
---------------
http("Get Request").get("/getEndpoint")
http("Post Request").post("/postEndpoint").body(StringBody("{"key":"value"}")).asJson
http("Put Request").put("/putEndpoint").body(StringBody("{"key":"value"}")).asJson
http("Delete Request").delete("/deleteEndpoint")

3. Headers and Body


-------------------
.headers(Map("Content-Type" -> "application/json"))
.body(StringBody("{"key":"value"}")).asJson
.body(RawFileBody("data.json"))

(Additional content truncated for brevity)

You might also like