Table of contents
3. All the results of the interface response:
4. How to write regular expressions:
5. Add a Debug PostProcessor debugger when debugging
6. You can view the obtained parameter results in Debug PostProcessor
7. Reference method: ${testValues_g1} and ${testValues_g2}
Eight, here is a little trick:
Nine, the meaning of matching numbers:
1. Background:
The same regular expression matches multiple response result values. Before adding multiple regular expressions, it is troublesome to get the required values one by one. Today, I tried to use a regular expression to get all the required values in the response. Using this method can also get the value specified in multiple results, which is perfect and easy!
2. For example:
I want to get the first two values (the values of barnType and trainScheduleBarnId) in the following response message: {"available":0,"barnNo":"01","barnType":"STX1","recommend" :0,"spaceStatus":"FULL","trainScheduleBarnId":3271}
3. All the results of the interface response:
{"content":{"barns":[{"available":0,"barnNo":"01","barnType":"STX1","recommend":0,"spaceStatus":"FULL","trainScheduleBarnId":3271},{"available":1,"barnNo":"02","barnType":"STX2","recommend":1,"spaceStatus":"EMPTY","trainScheduleBarnId":3272},{"available":0,"barnNo":"03","barnType":"STX3","recommend":0,"spaceStatus":"EMPTY","trainScheduleBarnId":3273},{"available":0,"barnNo":"04","barnType":"STX4","recommend":0,"spaceStatus":"EMPTY","trainScheduleBarnId":3274},{"available":1,"barnNo":"05","barnType":"STX1","recommend":0,"spaceStatus":"EMPTY","trainScheduleBarnId":3275},{"available":1,"barnNo":"06","barnType":"STX2","recommend":0,"spaceStatus":"EMPTY","trainScheduleBarnId":3276},{"available":0,"barnNo":"07","barnType":"STX3","recommend":0,"spaceStatus":"EMPTY","trainScheduleBarnId":3277},{"available":0,"barnNo":"08","barnType":"STX4","recommend":0,"spaceStatus":"EMPTY","trainScheduleBarnId":3278}],"count":3,"endStationId":2101,"endStationName":"石家庄","endTime":1525491060000,"id":414,"startStationId":2401,"startStationName":"太原","startTime":1525059060000,"trainNo":"K707"},"errorCode":null,"errorMsg":null,"status":"OK"}
4. How to write regular expressions:
5. Add a Debug PostProcessor debugger when debugging
6. You can view the obtained parameter results in Debug PostProcessor
7. Reference method: ${testValues_g1} and ${testValues_g2}
Eight, here is a little trick:
The order of the returned response results remains unchanged. What should I do if I want to get the values of different parameters each time? Only small changes are required
Nine, the meaning of matching numbers:
* 0 means random
* -1 means all
* 1 means the first
* 2 means the second
* ......