Last active
February 17, 2019 15:39
-
-
Save lacoski/844d8a05a758d57cdc6710c755e37ccf to your computer and use it in GitHub Desktop.
Ví dụ sử dụng Gatling.io Cloud365
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.concurrent.duration._ | |
import io.gatling.core.Predef._ | |
import io.gatling.http.Predef._ | |
import io.gatling.jdbc.Predef._ | |
class RecordedSimulation extends Simulation { | |
val httpProtocol = http | |
.baseUrl("http://10.10.10.86") | |
.inferHtmlResources() | |
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8") | |
.acceptEncodingHeader("gzip, deflate") | |
.acceptLanguageHeader("en-US,en;q=0.9") | |
.upgradeInsecureRequestsHeader("1") | |
.userAgentHeader("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36") | |
val headers_0 = Map( | |
"Proxy-Connection" -> "keep-alive", | |
"Purpose" -> "prefetch") | |
val headers_2 = Map( | |
"Origin" -> "http://10.10.10.86", | |
"Proxy-Connection" -> "keep-alive") | |
val scn = scenario("RecordedSimulation") | |
.exec(http("truy_cap_trang_chu") | |
.get("/") | |
.headers(headers_0)) | |
.pause(2) | |
.exec(http("chuyen_sang_trang_admin") | |
.get("/admin/") | |
.check(css("input[name=csrfmiddlewaretoken]", "value").saveAs("stoken")) | |
.headers(headers_0)) | |
.pause(7) | |
.exec(http("dang_nhap_admin") | |
.post("/admin/login/?next=/admin/") | |
.headers(headers_2) | |
.formParam("csrfmiddlewaretoken", "${stoken}") | |
.formParam("username", "admin") | |
.formParam("password", "Cloud365a@123") | |
.formParam("next", "/admin/")) | |
.pause(7) | |
.exec(http("dang_xuat_trang_admin") | |
.get("/admin/logout/") | |
.headers(headers_0)) | |
setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment