空手道-加特林:报告中带有查询参数的请求不会被聚合 [英] Karate-Gatling: Requests with query parameter in reports are not getting aggregated
本文介绍了空手道-加特林:报告中带有查询参数的请求不会被聚合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在做空手道把关的POC,以重复使用我的测试。我已经参考了文档并安装了这些版本。首先,像往常一样出色的工作,非常容易设置和开始。
我正在从MySimualtion.scala调用一个功能文件,它还有另外三个抽象功能调用,如下所示:
* def tranRef = TransactionReferenceUtils.generateTransactionReferenceStartWith('09')
* set payloadR /transaction_reference = tranRef
POST API >> /sending/v1/dm
* call read('classpath:../InitiateAbstract.feature')
* match responseStatus == 200
GET API By Reference >> /sending/v1/dm?ref={ref}
* call read('classpath:../RetrieveByRefAbstract.feature') {ref: #(tranRef)}
* match responseStatus == 200
GET API By Id>> /sending/v1/dm/{id}
* call read('classpath:../RetrieveByIdAbstract.feature') {id: #(pmId)}
* match responseStatus == 200
抽象功能使用url关键字调用API。
MySimulation.scala如下所示
class MySimulation extends Simulation {
val protocol = karateProtocol(
"/sending/v1/dm?ref={ref}" -> Nil,
"/send/v1/dm/{id}" -> Nil,
"/sending/v1/dm" -> Nil
)
protocol.nameResolver = (req, ctx) => req.getUrlAndPath()
val create = scenario("create").exec(karateFeature("classpath:com/mastercard/send/xb/Testcases/Rem1Shot/Remit1ShotWithFrwdFeesRetrieve.feature"))
setUp(
create.inject(rampUsers(2) during (5 seconds)).protocols(protocol)
)
}
现在的问题是,在报告中,使用{id}的GET请求和POST请求被聚合,但使用REF的GET请求被单独报告。
我还尝试将nameResolver与getUrlAndPath一起使用,但仍未成功。
我不确定这里是否遗漏了什么。
注意: 还有一个问题是,我无法使用以下协议聚合带有ID的GET请求,但现在如果我包含完整的URI就可以了。
"/dm/{id}" -> Nil,
"/dm" -> Nil
对于GET请求,传递一个伪头并使用它来控制推荐答案:<[3-0]
我本以为/sending/v1/{dm}
或类似的东西会起作用。
请注意,理论上您可以编写一些定制的Scala代码来解析URL并执行名称解析。如果您觉得这应该变得更容易,请提交功能请求,或者更好的做法是贡献代码!
这篇关于空手道-加特林:报告中带有查询参数的请求不会被聚合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文