fugmag
1
given my working simulation, this gives me all the occurrences of instances in a json response:
`
.check(jsonPath("$.membershipCoupons[?(@.membershipId==’${MemberId}’)].coupons[?(@.activationDate==null)].offerId").findAll.optional.saveAs(“itemList”))
`
and this gives me the fist one in the same response:
`
.check(jsonPath("$.membershipCoupons[?(@.membershipId==’${MemberId}’)].coupons[0].offerId").findAll.optional.saveAs(“itemList”))
`
but how can I get just the 8 first occurrences?
This does not work:
`
.check(jsonPath("$.membershipCoupons[?(@.membershipId==’${MemberId}’)].coupons[0-7].offerId").findAll.optional.saveAs(“itemList”))
`
Thanks
fugmag
2
.check(jsonPath("$.membershipCoupons[?(@.membershipId==’${MemberId}’)].coupons[0,1,2,3,5,5,6,7].offerId").findAll.optional.saveAs(“itemList”))
Can you not do a ‘take’ or a ‘dropWhile’ on the full collection or something?
fugmag
5
Thanks guys,
.check(jsonPath("$.membershipCoupons[?(@.membershipId==’${MemberId}’)].coupons[0:8].offerId").findAll.optional.saveAs(“itemList”))
fugmag
6
Is it possible to combine ?(@.activationDate==null with [0:8]
in one expression?
I have
`
.check(jsonPath("$.membershipCoupons[?(@.membershipId==’${MemberId}’)].coupons[?(@.activationDate==null)].offerId").findAll.optional.saveAs(“itemList”))
`
and
`
.check(jsonPath("$.membershipCoupons[?(@.membershipId==’${MemberId}’)].coupons[0:8].offerId").findAll.optional.saveAs(“itemList”))
`
something like:
.check(*jsonPath*(**"$.membershipCoupons[?(@.membershipId=='${MemberId}')].coupons[?(@.activationDate==null) &&** **[0:8]****].offerId"**).findAll.optional.saveAs(**"itemList"**))
?