我正在使用有效负载对以下URL进行post调用,我想获取值new_name
和mib_title
。
POST https://api.dev.net/api/data/v9.0/new_studies
POST data:
{"new_readenddate":"2022-08-04T08:03:08.26Z","new_studystatus":100000001,"new_serviceenddate":"2022-08-24T08:03:08.26Z","new_phase":100000000,"new_SponsorOrganization@odata.bind":"/cr420_sponsors(0d8ab049-eb08-ed11-82e4-002248093996)","new_SponsorOrganization@OData.Community.Display.V1.FormattedValue":"0VFRwqrK","cr420_contractvalue":22424,"new_readstartdate":"2022-08-04T08:03:08.26Z","new_servicestartdate":"2022-07-31T08:03:08.26Z","new_studystate":100000000,"new_globalstudyid":"2224","mib_title":"PERF2VxlO3BPI","new_name":"PERF6TruGhT8M","mib_isretry":false,"mib_flowstate":913380000,"statuscode":1,"statecode":0,"ownerid@odata.bind":"/systemusers(6d94fcb3-32e2-ec11-bb3d-000d3a3437fc)","ownerid@OData.Community.Display.V1.FormattedValue":"PerformanceExecuter"}
Cookie Data:
ReqClientId=24552c6c-7e0b-43cb-b59e-953a77233416;
添加了一个后处理器以使用以下代码检索JSR223后处理器,
import groovy.json.JsonSlurper
def requestPayLoad = "";
sampler.getArguments().each {arg ->
requestPayLoad = arg.getStringValue()
}
def removedSymbolPayload = requestPayLoad.replace('=', '');
removedSymbolPayload.each { getKeyValue ->
log.info("Key = " + getKeyValue)
}
我得到的回应是,
2022-08-02 20:03:08,899 INFO o.a.j.e.J.JSR223 PostProcessor: Key = {
2022-08-02 20:03:08,899 INFO o.a.j.e.J.JSR223 PostProcessor: Key = "
2022-08-02 20:03:08,899 INFO o.a.j.e.J.JSR223 PostProcessor: Key = n
2022-08-02 20:03:08,899 INFO o.a.j.e.J.JSR223 PostProcessor: Key = e
2022-08-02 20:03:08,899 INFO o.a.j.e.J.JSR223 PostProcessor: Key = w
2022-08-02 20:03:08,899 INFO o.a.j.e.J.JSR223 PostProcessor: Key = _
2022-08-02 20:03:08,899 INFO o.a.j.e.J.JSR223 PostProcessor: Key = r
2022-08-02 20:03:08,899 INFO o.a.j.e.J.JSR223 PostProcessor: Key = e
2022-08-02 20:03:08,899 INFO o.a.j.e.J.JSR223 PostProcessor: Key = a
2022-08-02 20:03:08,899 INFO o.a.j.e.J.JSR223 PostProcessor: Key = d
2022-08-02 20:03:08,899 INFO o.a.j.e.J.JSR223 PostProcessor: Key = e
2022-08-02 20:03:08,899 INFO o.a.j.e.J.JSR223 PostProcessor: Key = n
2022-08-02 20:03:08,899 INFO o.a.j.e.J.JSR223 PostProcessor: Key = d
2022-08-02 20:03:08,899 INFO o.a.j.e.J.JSR223 PostProcessor: Key = d
2022-08-02 20:03:08,899 INFO o.a.j.e.J.JSR223 PostProcessor: Key = a
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = t
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = e
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = "
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = :
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = "
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = 2
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = 0
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = 2
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = 2
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = -
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = 0
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = 8
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = -
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = 0
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = 4
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = T
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = 0
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = 8
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = :
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = 0
2022-08-02 20:03:08,900 INFO o.a.j.e.J.JSR223 PostProcessor: Key = 3(contd..)
我做错的是
1条答案
按热度按时间z31licg01#
为什么需要从request中获取数据呢?发送请求的是你,你应该事先知道属性的值,如果你不知道--这意味着你的测试设计得很糟糕。
随便啦
您要查找的代码类似于:
演示:
更多信息: