0
ギャトリングで条件が(シナリオに基づいて)可能であるかどうかを知りたいと思います。ギャトリングシナリオに基づく条件
私はガトリングでログインポストは非常に似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はこれをサポートしていますか?
http("User login")
.post("/api/user_login")
.headers(if(session.scenarioName.equals("user1")) Headers.headers_1 else Headers.headers_2)
session
しかし、それはあなたのactions
のパラメータを使用するように、あなたのためのオプションが考えられます:
.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
})