加特林如何将捕获的动态值替换为列表
Gatling how to substitute the dynamic values captured to a list
在 gatling 中,我使用以下检查功能从请求中提取 属性id 的列表。
.get(uri21 + "/search/address/q=20+ABC+Street&qt=address&view=property&newSearch=true&searchWindowId=")
.check(regex("""propertyKey="(.*?)"""").findAll.saveAs("propertyid")))
.exec(session => {
println(session("propertyid").as[String])
session
})
我正在将以下 属性 个 ID 捕获到列表中。
List(44772164, 44772175, 44772176, 44772177, 44772196, 44772197, 44772198, 44772212, 44772213, 44772214, 44772226, 44772227, 44772228, 44772247, 44772248, 44772249, 44772260, 44772261, 44772262, 44772276)
我需要在以下请求中以逗号分隔格式格式化和替换这些值(如下面的请求)。根据地址的不同,属性id 的数量会有所不同。可以有 1 个或多个,请您指导我如何完成。
.exec(http("/torchlist")
.get(uri21 +“ /torchlist/status。json?property_id = 44772164,44772175,44772176,447772177,44772177,44772196,447772197,4477772198 44772247, 44772248, 44772249, 44772260, 44772261, 44772262, 44772276&_=1627273897640&search_type_param=地址"))
在支票中使用 transform
,参见 https://gatling.io/docs/gatling/reference/current/http/check/#transforming
.get(uri21 + "/search/address/q=20+ABC+Street&qt=address&view=property&newSearch=true&searchWindowId=")
.check(
regex("""propertyKey="(.*?)"""")
.findAll
.transform(listOfIds => listOfIds.mkString(","))
.saveAs("concatenatedIds")
)
)
在 gatling 中,我使用以下检查功能从请求中提取 属性id 的列表。
.get(uri21 + "/search/address/q=20+ABC+Street&qt=address&view=property&newSearch=true&searchWindowId=")
.check(regex("""propertyKey="(.*?)"""").findAll.saveAs("propertyid")))
.exec(session => {
println(session("propertyid").as[String])
session
})
我正在将以下 属性 个 ID 捕获到列表中。
List(44772164, 44772175, 44772176, 44772177, 44772196, 44772197, 44772198, 44772212, 44772213, 44772214, 44772226, 44772227, 44772228, 44772247, 44772248, 44772249, 44772260, 44772261, 44772262, 44772276)
我需要在以下请求中以逗号分隔格式格式化和替换这些值(如下面的请求)。根据地址的不同,属性id 的数量会有所不同。可以有 1 个或多个,请您指导我如何完成。
.exec(http("/torchlist") .get(uri21 +“ /torchlist/status。json?property_id = 44772164,44772175,44772176,447772177,44772177,44772196,447772197,4477772198 44772247, 44772248, 44772249, 44772260, 44772261, 44772262, 44772276&_=1627273897640&search_type_param=地址"))
在支票中使用 transform
,参见 https://gatling.io/docs/gatling/reference/current/http/check/#transforming
.get(uri21 + "/search/address/q=20+ABC+Street&qt=address&view=property&newSearch=true&searchWindowId=")
.check(
regex("""propertyKey="(.*?)"""")
.findAll
.transform(listOfIds => listOfIds.mkString(","))
.saveAs("concatenatedIds")
)
)