我在下面写了下面的Gatling场景。我收到以下错误
值baseURL不是io.gatling.http.protocol.HttpProtocolBuilder的成员
我试着直接导入io.gatling.http.protocol.HttpProtocolBuilder,但这并没有解决问题。任何人都可以在下面的代码中找出根本原因吗?
此外,我希望这个场景在2000个用户的4小时内增加到100万个请求。下面的注射是否成功执行了该负载?
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
class Kafka extends Simulation{
val httpProtocol = http.baseURL("https://apex-my-url-is.in.these.quotes.com");
val kafkaScenario = scenario("KafkaPerfTest")
.exec(http("Kafka Request").post("/method/method")
.header("Content-Type", "application/json")
.body(StringBody("""
{
"logDatetime": "2019-03-18T20:26:38.940Z",
"url": "/test",
"apiName": "test",
"apiVersion": "test",
"method": "GET",
"status": 200,
"vin": "TESTTESTVIN0001",
"accessToken": "test",
"user": "test",
"queryParams": "",
"requestHeader": "test",
"requestBody": "test",
"responseHeader": "test",
"responseBody": "test",
"responseTime": 200,
"traceId": "test",
"serviceName": "test",
"type": "INBOUND"
}
"""))
.check(status.is(202)));
setUp(kafkaScenario.inject(
constantConcurrentUsers(2000) during(4 hours))
.protocols(httpProtocol)
.throttle(jumpToRps(500),holdFor(4 hours)));
}
试试“http.baseUrl”而不是“http.baseURL”