我正在使用 Gatling 工具对 API 进行负载测试。我想过将过程隔离为对象。但是当我运行我的场景时,我收到以下错误:
Simulation testapi.AdvancedSimulationStep05 started...
14:12:50.981 [WARN ] i.g.h.a.ResponseProcessor - Request 'PostMultiline' failed: status.find.in(200,304,201,202,203,204,205,206,207,208,209), but actually found 400
14:12:50.981 [WARN ] i.g.h.a.ResponseProcessor - Request 'PostMultiline' failed: status.find.in(200,304,201,202,203,204,205,206,207,208,209), but actually found 400
下面是我的 Scala 模拟代码:
class AdvancedSimulationStep05 extends Simulation {
object Search {
val search = exec(
http("PostMultiline")
.post("/t_rates/v1/quotations")
.header("Content-Type", "application/json")
.body(RawFileBody("test.json")).asJSON
)
}
val httpConf = http
.baseURL("https://central-us.rates")
.acceptHeader("application/json, */*")
.acceptCharsetHeader("UTF-8")
val users = scenario("Users").exec(Search.search)
val admins = scenario("Admins").exec(Search.search)
setUp(
users.inject(rampUsers(10) over (10 seconds)),
admins.inject(rampUsers(2) over (10 seconds))
).protocols(httpConf)
}
我尝试了几种运行模拟的组合,但我仍然得到错误。如果我能从专家那里得到一些建议,那就太好了。