我有一个场景,在执行加特林时。sh,我需要从终端传递授权,而不是总是去更改situation.scala文件,因为授权仅针对特定指定,一旦用户注销,我们需要提供新的登录身份验证密钥。基本上我们可以在 Gatling 性能测试中运行 gatling.sh 时从命令行传递参数。请检查simulation.scala 文件以供参考。""authorization" -> "运行 gatling.sh 时需要从终端传递值","
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("baseURL")
.inferHtmlResources()
val headers_0 = Map(
"accept" -> "*/*",
"accept-encoding" -> "gzip, deflate, br",
"accept-language" -> "en-US,en;q=0.9",
"access-control-request-headers" -> "access-control-allow-origin,authorization,content-type",
"access-control-request-method" -> "GET",
"origin" -> "URL_LINK",
"user-agent" -> "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36")
val headers_1 = Map(
"accept" -> "*/*",
"accept-encoding" -> "gzip, deflate, br",
"accept-language" -> "en-US,en;q=0.9",
"access-control-allow-origin" -> "*",
**"authorization" -> "Need to pass value from the terminal while running the gatling.sh",**
"content-type" -> "application/json",
"origin" -> "ORIGIN_URL",
"referer" -> "REFERER_URL",
"user-agent" -> "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36")