Skip to content

Instantly share code, notes, and snippets.

@swapnil-kotwal-sp
Created September 3, 2014 11:07
Show Gist options
  • Save swapnil-kotwal-sp/4e5ba56fe7da82b4c751 to your computer and use it in GitHub Desktop.
Save swapnil-kotwal-sp/4e5ba56fe7da82b4c751 to your computer and use it in GitHub Desktop.
Basic Login functionality for you web app using Gatling DSL.
Make sure you have "login.csv" in gatling data folder and
"login.csv" contains proper creadentials to login into your web app.
package mywebapp.lib
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import mywebapp.config._
object Login {
val headers_10 = GatlingConfig.headers_10
val feeder = csv("login.csv").circular//queue :- will move step by step
//circular :- it iterate over whatever number of rows available.
val login = exec(http("Login")
.get("/login"))
.pause(1)
.feed(feeder)
.exec(http("authorization")
.post("/auth")
.headers(headers_10)
.queryParam("""email""", "${email}")
.queryParam("""password""", "${password}")
.check(status.is(200))
.check(jsonPath("$.Message").is("Success")))
.pause(1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment