hau*_*ron 6 assert scala gatling
带有执行链的加特林场景。请求后,将保存返回的数据。稍后对其进行处理,并且根据处理结果,它应该失败或通过测试。
这似乎是最简单的情况,但是我找不到任何可靠的信息如何在exec块中使测试失败。assert打破了场景,看起来像是加特林(例如:异常抛出不仅使测试失败)。
例:
// 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");
})
))
Run Code Online (Sandbox Code Playgroud)
在方案上方的某个地方,“守护者失败,关闭了系统”。
现在,这似乎是一件有用且经常使用的事情-我可能会错过一些简单的事情。怎么做?
您必须遵守 Gatling API。
processData在检查中执行您的检查,通常是在转换可选步骤中。| 归档时间: |
|
| 查看次数: |
6384 次 |
| 最近记录: |