Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gatling scenario
import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import scala.util.Random
import com.excilys.ebi.gatling.core.feeder.Feeder
class ServiceSimulation extends Simulation {
def apply = {
val random = new Random
random.setSeed(System.currentTimeMillis)
val urlBase = "http://internalservice.com:8080"
val httpConf = httpConfig.baseURL(urlBase)
val customFeeder = new Feeder() {
def next = {
val email = "%s%s%s" format("SERVICETESTtwo", random.nextInt.toString, "@example.com")
Map("userEmail" -> email)
}
}
val headers_93 = Map(
"Accept" -> """application/json,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5""",
"Accept-Encoding" -> """gzip, deflate""",
"Accept-Language" -> """en-us""",
"Connection" -> """keep-alive""",
"Pragma" -> """no-cache""",
"User-Agent" -> """Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/531.21.11 (KHTML, like Gecko) Version"""
)
val saveIdChain = chain.exec(
http("postId")
.post("/internal/path/to/resource")
.fileBody("idBody", Map("email" -> "${userEmail}")).asJSON
.check(status.is(201))
)
val scn = scenario("ServiceTest1").feed(customFeeder)
.insertChain( saveIdChain )
List(
scn.configure.users(TestSettings.userCount).ramp(TestSettings.ramp).protocolConfig(httpConf)
)
}
}
object TestSettings {
val userCount = 25000
val ramp = 60
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment