0
我想知道Gatling中是否可以使用條件(基於場景)。基於Gatling場景的條件
我在轉管登錄後2.1.7像這樣:
.exec(http("User login")
.post("/api/user_login")
.headers(Headers.headers_1))
隨着幾個場景:
val user1 = scenario("user1").exec(
Action.login,
Action.addDocument,
Action.logout
)
val user2 = scenario("user2").exec(
Action.login,
Action.deleteDocument,
Action.logout
)
setUp(
user1.inject(atOnceUsers(1))
user2.inject(atOnceUsers(1))
).protocols(httpProtocol)
每個用戶都有單獨的登錄憑證(在報頭中),和只能以某種方式與應用進行交互。
因此(在僞代碼中)Gatling是否支持這樣的東西?
.exec(http("User login")
.post("/api/user_login")
.doIf(scenario == "users1") {
.headers(Headers.headers_1) // login info for user1
}
.doIf(scenario == "users2") {
.headers(Headers.headers_2) // login info for user2
})