带有 exec 链的 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");
})
))
在“监护人失败,关闭系统”的某个地方的场景之上。
现在这似乎是一件有用的、经常使用的事情——我可能错过了一些简单的事情。怎么做?