jmeter中遇到的小问题

字数 81阅读 24

1.json 提取
例1:数据格式:

"categoryCount":,
        "studentList":[
            {
                "userId":,
                "sessionUserTrackingId":,
                "fullName":"",
                "score":null,
                "percentScore":null,
                "statusId":1,
                "scoreOrder":1,
                "isLate":false,
                "isEmend":false,
                "emendQuestionCount":0,
                "emendCount":0,
                "intensifyEmendQuestionCount":0,
                "intensifyEmendCount":0,
                "emendStatus":"",
                "emendTypeCode":"NO_NEED",
                "completedOn":null,
                "endDate":"",
                "alreadyPay":false
            },
            {
                "userId":,
                "sessionUserTrackingId":,
                "fullName":"",
                "score":null,
                "percentScore":null,
                "statusId":1,
                "scoreOrder":2,
                "isLate":false,
                "isEmend":false,
                "emendQuestionCount":0,
                "emendCount":0,
                "intensifyEmendQuestionCount":0,
                "intensifyEmendCount":0,
                "emendStatus":"",
                "emendTypeCode":"NO_NEED",
                "completedOn":null,
                "endDate":"1538150340",
                "alreadyPay":false
            },

提取userId对应的sessionUserTrackingId的对应提取方式: $..[?(@.userId==123)].sessionUserTrackingId。
2.如果我们想要拿到某一个字段的部分数据的话可以使用:

contractId:"contract1234567"

如果我们提取1234567的话,使用正则表达式匹配:"contract:(.+?)"

推荐阅读更多精彩内容