带有一个执行链的Gatling场景。请求之后,将保存返回的数据。稍后,它将被处理,并且取决于处理结果,它要么失败,要么通过测试。
这似乎是最简单的可能方案,但我找不到任何可靠的信息,如何在一个exec块内的测试失败。assert打破了场景,似乎是Gatling (如:异常抛出并不仅仅是测试失败)。
示例:
// The scenario consists of a single test with two exec creating the execChain
val scn = scenario("MyAwesomeScenario").exec(reportableTest(
// Send the request
exec(http("127.0.0.1/Request").get(requestUrl).check(status.is(200)).check(bodyString.saveAs("MyData")
// Process the data
.exec(session => {
assert(processData(session.attributes("MyData")) == true, "Invalid data");
})
))上面的场景大致是“卫报失败,关闭系统”。
现在,这似乎是一件有用的、经常使用的事情--我可能遗漏了一些简单的东西。该怎么做呢?
发布于 2017-05-30 04:27:56
你是在找像
.exec(http("getRequest")
.get("/request/123")
.headers(headers)
.check(status.is(200))
.check(jsonPath("$.request_id").is("123")))https://stackoverflow.com/questions/25622470
复制相似问题