1
我正在尝试创建一个Gatling场景,该场景需要在测试期间将协议切换到不同的主机。用户旅途是场景期间的Gatling切换协议
https://example.com/page1
https://example.com/page2
https://accounts.example.com/signin
https://example.com/page3
以便作为单个场景的一部分,我需要醚切换中建立场景定义的,或切换的协议所定义的baseUrl
但我不能找出如何去做。
基本方案可能看起来像
package protocolexample
import io.gatling.core.Predef._
import io.gatling.http.Predef._
class Example extends Simulation {
val exampleHttp = http.baseURL("https://example.com/")
val exampleAccountsHttp = http.baseURL("https://accounts.example.com/")
val scn = scenario("Signin")
.exec(
http("Page 1").get("/page1")
)
.exec(
http("Page 2").get("/page2")
)
.exec(
// This needs to be done against accounts.example.com
http("Signin").get("/signin")
)
.exec(
// Back to example.com
http("Page 3").get("/page3")
)
setUp(
scn.inject(
atOnceUsers(3)
).protocols(exampleHttp)
)
}
我只需要弄清楚如何醚切换为第三步主机或协议。我知道我可以创建多个场景,但这需要跨越多个主机成为单个用户流。
我试图直接使用其他协议
exec(
// This needs to be done against accounts.example.com
exampleAccountsHttp("Signin").get("/signin")
)
这导致
protocolexample/example.scala:19: type mismatch;
found : String("Signin")
required: io.gatling.core.session.Session
exampleAccountsHttp("Signin").get("/signin")
,也将有关该请求
exec(
// This needs to be done against accounts.example.com
http("Signin").baseUrl("https://accounts.example.com/").get("/signin")
)
这导致
基URLprotocolexample/example.scala:19: value baseUrl is not a member of io.gatling.http.request.builder.Http
@Meiko嗨,对不起,因为延误。标记为已接受 – Smudge