I need some help putting together a Gatling to test stress my API. I am still new to Gatliong so any help would be appreciated.
so I have this new service API called “getDriver” using the “Advanced rest client” on chrome I pass in header and a body and it returns result.
example:
POST
https://Myserver-service…mycompany.com/uservice/http/driver/json
Header is context: {“uID”:0,“gId”:0,“drId”:159577,“cId”:0,"__isset_bitfield":4,“optionals”:[“CLIENT”]}
Body is [1,“getDriver”,1,1,{“1”:{“rec”:{“1”:{“i64”:0},“4”:{“i64”:12345},“5”:{“i64”:0}}}}]
My question is how do I take this and convert it to a Gatling test ?
this is what I have so far, which I know is not correct!!!
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
class Test extends Simulation {
val httpProtocol = http
.baseURL(“https://myserver-uservice.mycompany.com”)
.inferHtmlResources()
.acceptHeader("""/""")
.acceptEncodingHeader(""“gzip, deflate”"")
.acceptLanguageHeader(""“en-US,en;q=0.5"”")
.connection(""“keep-alive”"")
.contentTypeHeader(""“application/x-www-form-urlencoded; charset=UTF-8"”")
.userAgentHeader(""“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:32.0) Gecko/20100101 Firefox/32.0"”")
val headers_0 = Map(
//""“context”""-> “”"{“uId”:0,“gId”:0,“dId”:159577,“cId”:0,"__isset_bitfield":4,“optionals”:[“CLIENT”]}""",
“”“Content-Type”"" → “”“text/json; charset=UTF-8"”"
)
val scn = scenario(“addonestop”)
.exec(http(“API”)
.post("""/userservice/http/driver/json""")
.headers(headers_0)
.body(StringBody(""""[1,“getDriver”,1,1,{“1"”: “{“rec”:{“1”:{“i64”:0},“4”:{“i64”:159577},“5”:{“i64”:0}}}}]” }""")).asJSON
)
.pause(4)
setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
}