0

対応は以下の通り、

Jmeter で JSON パスまたは REGEX を使用して実装する方法は?

{
  "apiResponseStatus": "SUCCESS",
  "deviceResponseList": [
    {
      "apiResponseStatus": "SUCCESS",
      "id": 23,
      "ownership": "CORPORATE",
      "deviceName": "Demimbu",
      "deviceType": "MOBILE",
      "osType": "ANDROID",
      "inTotalStorage": 0,
      "inAvailableStorage": 0,
      "exTotalStorage": 0,
      "exAvailableStorage": 0,
      "osVersion": "4.2",
      "buildVersion": "1.01.08",
      "status": "PENDING",
      "isDeleted": false,
      "policyIdNames": {
        "id": 3,
        "name": "Test Policy 3"
      },
      "deviceGroupIdNames": {
        "id": 1,
        "name": "Default Group"
      },
      "userIdName": {
        "id": 1,
        "name": "Randy Lewis"
      },
      "lastConnected": 1423810405000,
      "createdByIdName": {
        "id": 1,
        "name": "Randy Lewis"
      },
      "locked": false,
      "traceOn": false,
      "userEmail": "mdm.user1@gmail.com",
      "enrollmentDate": 1423790255000,
      "simNumbers": [
        "1236547896"
      ],
      "imeiCodes": [],
      "mobileNumbers": [
        "4558585858858"
      ],
      "createDate": 1421927250000,
      "lastModified": 1423810406000,
      "rooted": false,
      "roaming": false,
      "compliant": false
    },
    {
      "apiResponseStatus": "SUCCESS",
      "id": 24,
      "ownership": "CORPORATE",
      "deviceName": "Photobean",
      "deviceType": "MOBILE",
      "osType": "ANDROID",
      "inTotalStorage": 20941258752,
      "inAvailableStorage": 8024924160,
      "exTotalStorage": 0,
      "exAvailableStorage": 0,
      "bluetoothMacAddress": "8C:3A:E3:BE:C2:04",
      "wirelessMacAddress": "8c:3a:e3:51:bb:e3",
      "model": "LG-D686",
      "osVersion": "4.4.2",
      "buildVersion": "1.01.09",
      "status": "PENDING",
      "isDeleted": false,
      "policyIdNames": {
        "id": 3,
        "name": "Test Policy 3"
      },
      "deviceGroupIdNames": {
        "id": 1,
        "name": "Default Group"
      },
      "userIdName": {
        "id": 1,
        "name": "Randy Lewis"
      },
      "make": "LGE",
      "lastConnected": 1423648831000,
      "createdByIdName": {
        "id": 1,
        "name": "Randy Lewis"
      },
      "locked": false,
      "traceOn": false,
      "userEmail": "mdm.user1@gmail.com",
      "enrollmentDate": 1423628675000,
      "simNumbers": [
        "404909008623970"
      ],
      "imeiCodes": [
        "359004053152889",
        "359004053152871"
      ],
      "mobileNumbers": [
        "638847339387"
      ],
      "createDate": 1422435029000,
      "lastModified": 1423648831000,
      "rooted": true,
      "roaming": false,
      "compliant": false
    },
    {
      "apiResponseStatus": "SUCCESS",
      "id": 25,
      "ownership": "CORPORATE",
      "deviceName": "Livetube",
      "deviceType": "MOBILE",
      "osType": "ANDROID",
      "inTotalStorage": 0,
      "inAvailableStorage": 0,
      "exTotalStorage": 0,
      "exAvailableStorage": 0,
      "osVersion": "4.2",
      "buildVersion": "1.01.08",
      "status": "APPROVAL_PENDING",
      "isDeleted": false,
      "policyIdNames": {
        "id": 3,
        "name": "Test Policy 3"
      },
      "deviceGroupIdNames": {
        "id": 1,
        "name": "Default Group"
      },
      "userIdName": {
        "id": 1,
        "name": "Randy Lewis"
      },
      "lastConnected": 1423810522000,
      "createdByIdName": {
        "id": 1,
        "name": "Randy Lewis"
      },
      "locked": false,
      "traceOn": false,
      "userEmail": "mdm.user1@gmail.com",
      "enrollmentDate": 1423790371000,
      "simNumbers": [
        "1236547896"
      ],
      "imeiCodes": [],
      "mobileNumbers": [
        "4558585858858"
      ],
      "createDate": 1422435030000,
      "lastModified": 1423810522000,
      "rooted": false,
      "roaming": false,
      "compliant": false
    },
    {
      "apiResponseStatus": "SUCCESS",
      "id": 26,
      "ownership": "CORPORATE",
      "deviceName": "Riffwire",
      "deviceType": "MOBILE",
      "osType": "IOS",
      "inTotalStorage": 0,
      "inAvailableStorage": 0,
      "exTotalStorage": 0,
      "exAvailableStorage": 0,
      "status": "PENDING",
      "isDeleted": false,
      "policyIdNames": {
        "id": 3,
        "name": "Test Policy 3"
      },
      "deviceGroupIdNames": {
        "id": 1,
        "name": "Default Group"
      },
      "userIdName": {
        "id": 1,
        "name": "Randy Lewis"
      },
      "createdByIdName": {
        "id": 1,
        "name": "Randy Lewis"
      },
      "locked": false,
      "traceOn": false,
      "userEmail": "mdm.user1@gmail.com",
      "simNumbers": [],
      "imeiCodes": [],
      "mobileNumbers": [],
      "createDate": 1422435030000,
      "lastModified": 1423216312000,
      "rooted": false,
      "roaming": false,
      "compliant": false
    },

また、もしあれば良いオプションを提案してください。

4

2 に答える 2

0

あなたの質問は JMeter 固有のものですが、実際には通常の Json パス式だと思います。たとえば、SoapUI では次のように実行できます。

$.deviceResponseList[?(@.status=='PENDING')].id

おそらくこれは何らかの形で役立つ可能性があります

于 2015-02-20T12:42:21.450 に答える
0

JMeter は、JMeter Plugins Extras with Libs Setを介してJSON パスエクストラクタを提供します

これがあなたの目標を達成するための最良の方法であると私は信じています。

プラグインのインストール手順と JSON パス クエリのサンプルについては、JMeterガイドでの XPath エクストラクタの使用 (「JSON の解析」の章までスクロール) を参照してください。

于 2015-02-20T14:04:28.710 に答える