Gatling拓展插件开发,check(bodyString.saveAs("key"))怎么实现

2020-10-29 14:13发布

问题:

由于业务需要,需要拓展gatling性能测试插件,目前已经实现了请求发送,返回的检查

遇到了问题:

希望将上一次请求结果中的数据,保存到session中,在下一次请求中使用
实现check(bodyString.saveAs("key"))时,报了类型不匹配

注:在CheckSupport中已经做了隐式转换

  @implicitNotFound("Could not find a CheckMaterializer. This check might not be valid for SOAP.")
  implicit def checkBuilder2SoapCheck[A, P, X](checkBuilder: CheckBuilder[A, P, X])(implicit materializer: CheckMaterializer[A, SoapCheck, Response, P]): SoapCheck =
    checkBuilder.build(materializer)

回答1:

scala隐式转换,需要实现转换实现方式

object SoapXpathCheckMaterializer extends CheckMaterializer[SoapXpathCheckType, SoapCheck, Response, Response] {
    override val specializer: Specializer[SoapCheck, Response] = contextSpecializer
    override val preparer: Preparer[Response, Response] = PassThroughResponsePreparer
  }


标签: scala gatling