jmeter 使用JSON提取器和多个组合值规则捕获值

h7wcgrx3  于 2023-01-26  发布在  其他
关注(0)|答案(1)|浏览(114)
  1. from below response we need to capture
    if OrderNumber":{"value":"J-40-000093-VAN0001"} we need capture guid":"26177172834105110*
    {"changes":{},"commits":[],"committedObjectsOmitted":false,"deletes":[],"hasMoreItems":false,"newpersistable":[],"objects":[{"attributes":{"_ShowSites":{"value":false},"ICONStatusTime":{"readonly":true,"value":1674457196799},"DeliveryDate":{"value":null},"NativeMobile.Order_DeliveryAddress":{"value":null},"NativeMobile.Order_CustomFlowItems_Temp":{"value":null},"Status":{"value":"Complete"},"RequiredByDate":{"value":1674529200000},"CollectionASAP":{"value":true},"TotalPriceAtOrderSubmission":{"value":"122.42"},"NativeMobile.Order_Checkout_JobOrder":{"value":"68116944363989153"},"DropToCommunalArea":{"value":false},"CustomerReference":{"value":"testing1"},"OrderType":{"value":"JobOrder"},"DeliveryAccessRestricted":{"value":false},"NativeMobile.Order_SGBranch":{"readonly":true,"value":null},"APIAttemptsCount":{"readonly":true,"value":"1"},"Address":{"value":null},"OrderEmailStatus":{"value":"Success"},"_CreatedDate":{"value":1674456764925},"HasAtLeastOneItem":{"value":true},"NativeMobile.Order_UserAccount_Operative":{"value":"66991044457146029"},"CheckInDate":{"value":1674457678401},"NativeMobile.Order_Job_WiderOrder":{"value":null},"RequiresMobileSync":{"value":false},"ICONOrderStatus":{"readonly":true,"value":"Pending"},"TotalOrderPriceAtCheckIn":{"value":"122.42"},"OrderNumber":{"value":"J-40-000093-VAN0001"},"JobNumber":{"value":"jbdemo"},"FulfilmentMethod":{"value":"Collection"},"DeliveryAttended":{"value":null},"OrderAPI":{"value":"ICON"},"CustomerOrderTypeAtSubmission":{"readonly":true,"value":"JobOrder"},"OrderDateSubmitted":{"value":1674456764928},"SubOrderType":{"value":null},"NativeMobile.Order_OrderingEntity":{"value":"31806672368314430"},"ICONAPIStatus":{"value":null},"OrderPostStatus":{"value":"Success"},"isDeletedOnMobileDevice":{"value":false},"OrderNumberInteger":{"value":"93"}},"guid":"26177172834105110","hash":"fh+MfPCaDRjTn9gjdva5Qx5uxU+6lBjGDcmIpFWJ0OY=","objectType":"NativeMobile.Order"},
  2. from below response
    if NativeMobile.OrderItem_Order":{"value":"26177172834105120"} and NativeMobile.OrderItem_CustomerProduct":{"value":"28710447624498114"} we need to capture guid":"3659174697251949
    {"changes":{},"commits":[],"committedObjectsOmitted":false,"deletes":[],"hasMoreItems":false,"newpersistable":[],"objects":[{"attributes":{"ProductCode":{"value":null},"NativeMobile.OrderItem_Order":{"value":"26177172834105120"},"NativeMobile.OrderItem_DynamicCustomerProduct":{"value":null},"RequiresMobileSync":{"value":false},"AmountMatched":{"readonly":true,"value":"0"},"CheckInQuantity":{"value":"1"},"LineNumber":{"value":"4"},"CheckinPrice":{"value":"1"},"LineStatus":{"value":"Pick note printed"},"ProductName":{"value":null},"isDeletedOnMobileDevice":{"value":false},"OrderQuantity":{"value":"1"},"CheckinQuantityEdit":{"value":"0"},"NativeMobile.OrderItem_CustomerProduct":{"value":"28710447624498114"},"IsDeleted":{"value":false},"_CreatedDate":{"value":1674476500360},"FullyMatched":{"readonly":true,"value":false}},"guid":"3659174697251949","hash":"pzZHRHrMSglxWv+E8I+/1JFXiztj1NRykkEe3mWUhvM=","objectType":"NativeMobile.OrderItem"}
    Please help me to capture the guids
    Thanks
fhg3lkii

fhg3lkii1#

你不是问了一个同卵双胞胎这个问题吗?答案是完全一样的:
看看JSON Extractor,相关的JsonPath查询将是:

  1. $.objects[?(@.attributes.OrderNumber.value == 'J-40-000093-VAN0001')].guid

  1. $.objects[?(@.attributes.['NativeMobile.OrderItem_Order'].value == '26177172834105120' && @.attributes.['NativeMobile.OrderItem_CustomerProduct'].value=='28710447624498114')].guid

相关问题