JSON-Extractor is unable to extract the request response.

660 views
Skip to first unread message

nidhi.t...@gmail.com

unread,
Feb 12, 2018, 6:20:54 AM2/12/18
to codename-taurus
Hi, 

i am trying to extract response from a URL using JSON Extractor. But it is not working. below is my code. please suggest if i am doing anything wrong or anything is missing.

execution:
- concurrency: 1
  hold-for: 60s
  iterations: 1
  ramp-up: 20s
  scenario: Thread Group
scenarios:
  Thread Group:
    requests:
      follow-redirects: true
      label: HTTP Request
      method: GET
      extract-jsonpath:
        status_code: $.meta.code
        crid:
          default: '0'
          jsonpath: $.recordings.data.[12].ids    
    - if: '"${status_code}" != "200"'
      then:
        - extract-jsonpath:
            status_code: $.meta.code
            manifesturl:
                jsonpath: $.url
          label: manifest
          method: POST
        - if: '"${status_code}" != "200"'
          then:
            - extract-jsonpath:
                status_code: $.meta.code
              label: ChunkUrl
              method: GET
              url: ${manifesturl}
          else:
      else:

Andrey Pokhilko

unread,
Feb 12, 2018, 6:51:22 AM2/12/18
to codenam...@googlegroups.com

Hi,

It depends on structure of JSON result you get. Can you show JSON that you have?

Another way to troubleshoot this is to run it with "-gui", then JMeter will pop up and you will be able to see in View Results Tree what happens. Because it's not Taurus evaluates JSON expressions, it's JMeter who does.


Andrey Pohilko
Chief Scientist
P: +7 (909) 631-21-69
BlazeMeter Inc.
12.02.2018 14:20, nidhi.t...@gmail.com пишет:
CAUTION: This email originated from outside of CA. Do not click links or open attachments unless you recognize the sender and know the content is safe.

--
You received this message because you are subscribed to the Google Groups "codename-taurus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codename-taur...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codename-taurus/49382faa-cd70-461a-b5ce-f2d5ca47b999%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

nidhi.t...@gmail.com

unread,
Feb 12, 2018, 7:57:19 AM2/12/18
to codename-taurus
Hi Andrey,

below is the JSON which i am getting as part of first URL. this i tried over Postman. but through Taurus i am not getting any response.

{
    "recordings": {
        "total": 33,
        "data": [
            {
                "source": "show",
                "id": "crid:~~2F~~2Fbds.tv~~2Fs37394892",
                "type": "show",
                "title": "NOS Tekst tv",
                "channelId": "0065",
                "mostRelevantEpisode": {
                    "startTime": "2018-02-12T02:30:00.000Z",
                    "endTime": "2018-02-12T05:20:00.000Z",
                    "duration": 10200,
                    "recordingState": "recorded",
                    "viewState": "notWatched",
                    "pinProtected": false,
                    "id": "crid:~~2F~~2Fbds.tv~~2F280041831,imi:0010000000228828",
                    "technicalDuration": 10200
                },
                "seasons": [],
                "poster": {
                    "type": "BoxCover"
                },
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "show",
                "id": "crid:~~2F~~2Fbds.tv~~2Fs45806467",
                "type": "show",
                "title": "Noord Vandaag",
                "channelId": "0191",
                "mostRelevantEpisode": {
                    "startTime": "2018-02-10T04:05:00.000Z",
                    "endTime": "2018-02-10T04:25:00.000Z",
                    "duration": 1200,
                    "recordingState": "recorded",
                    "viewState": "notWatched",
                    "pinProtected": false,
                    "id": "crid:~~2F~~2Fbds.tv~~2F721146929,imi:00100000002132AC",
                    "technicalDuration": 1200
                },
                "seasons": [],
                "poster": {
                    "type": "HighResPortrait"
                },
                "expirationDate": "2018-02-12T01:13:00.000Z",
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "show",
                "id": "crid:~~2F~~2Fbds.tv~~2Fs109720500",
                "type": "season",
                "title": "2Doc",
                "minimumAge": 16,
                "channelId": "0065",
                "mostRelevantEpisode": {
                    "startTime": "2018-02-01T23:15:00.000Z",
                    "endTime": "2018-02-02T00:30:00.000Z",
                    "duration": 4500,
                    "recordingState": "recorded",
                    "viewState": "notWatched",
                    "minimumAge": 16,
                    "pinProtected": false,
                    "id": "crid:~~2F~~2Fbds.tv~~2F145731459,imi:001000000020BD06",
                    "seasonId": "crid:~~2F~~2Fbds.tv~~2Fs109720500",
                    "technicalDuration": 4800
                },
                "seasons": [],
                "showId": "crid:~~2F~~2Fbds.tv~~2F109720500",
                "poster": {
                    "type": "HighResPortrait"
                },
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "show",
                "id": "crid:~~2F~~2Fbds.tv~~2F275822513",
                "type": "show",
                "title": "Van Harte",
                "channelId": "0065",
                "mostRelevantEpisode": {
                    "startTime": "2018-02-01T16:55:00.000Z",
                    "endTime": "2018-02-01T17:30:00.000Z",
                    "episodeNumber": 16,
                    "duration": 2100,
                    "recordingState": "recorded",
                    "viewState": "notWatched",
                    "pinProtected": false,
                    "id": "crid:~~2F~~2Fbds.tv~~2F278765203,imi:001000000020BD10",
                    "technicalDuration": 2100
                },
                "seasons": [],
                "poster": {
                    "type": "BoxCover"
                },
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "single",
                "position": 0,
                "startTime": "2018-02-06T12:40:00.000Z",
                "duration": 1142,
                "id": "crid:~~2F~~2Fbds.tv~~2F278339053,imi:0010000000219EBF",
                "type": "single",
                "title": "NOS Journaal",
                "recordingState": "partiallyRecorded",
                "channelId": "0062",
                "technicalDuration": 1142,
                "seasons": [],
                "showId": "crid:~~2F~~2Fbds.tv~~2Fs36652625",
                "episodeTitle": "NOS Journaal",
                "poster": {
                    "type": "BoxCover"
                },
                "viewState": "notWatched",
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "single",
                "position": 803,
                "startTime": "2018-02-06T10:15:00.000Z",
                "duration": 2700,
                "id": "crid:~~2F~~2Fbds.tv~~2F278338909,imi:0010000000219EC7",
                "type": "single",
                "title": "Tijd voor MAX",
                "recordingState": "recorded",
                "channelId": "0062",
                "technicalDuration": 2700,
                "seasons": [],
                "showId": "crid:~~2F~~2Fbds.tv~~2F37395234",
                "poster": {
                    "type": "BoxCover"
                },
                "viewState": "partiallyWatched",
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "single",
                "position": 63,
                "startTime": "2018-02-06T10:09:00.000Z",
                "duration": 193,
                "id": "crid:~~2F~~2Fbds.tv~~2F721237396,imi:0010000000208F6E",
                "type": "single",
                "title": "Jokie",
                "minimumAge": 0,
                "recordingState": "partiallyRecorded",
                "channelId": "0089",
                "technicalDuration": 193,
                "seasons": [],
                "showId": "crid:~~2F~~2Fbds.tv~~2F43598310",
                "poster": {
                    "type": "HighResPortrait"
                },
                "viewState": "partiallyWatched",
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "single",
                "position": 0,
                "startTime": "2018-02-05T13:00:00.000Z",
                "duration": 900,
                "id": "crid:~~2F~~2Fbds.tv~~2F275921689,imi:0010000000219EF9",
                "type": "single",
                "title": "NOS Journaal",
                "recordingState": "recorded",
                "channelId": "0062",
                "technicalDuration": 900,
                "seasons": [],
                "showId": "crid:~~2F~~2Fbds.tv~~2Fs36652793",
                "poster": {
                    "type": "BoxCover"
                },
                "viewState": "notWatched",
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "show",
                "id": "crid:~~2F~~2Fbds.tv~~2F237602358",
                "type": "season",
                "title": "Nachtzoen",
                "channelId": "0065",
                "mostRelevantEpisode": {
                    "startTime": "2018-02-03T23:55:00.000Z",
                    "endTime": "2018-02-04T00:10:00.000Z",
                    "episodeNumber": 127,
                    "duration": 900,
                    "recordingState": "recorded",
                    "viewState": "partiallyWatched",
                    "pinProtected": false,
                    "id": "crid:~~2F~~2Fbds.tv~~2F264859974,imi:0010000000212827",
                    "seasonId": "crid:~~2F~~2Fbds.tv~~2F237602358",
                    "technicalDuration": 900
                },
                "seasons": [],
                "showId": "crid:~~2F~~2Fbds.tv~~2F37428711",
                "poster": {
                    "type": "BoxCover"
                },
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "single",
                "position": 0,
                "startTime": "2018-02-01T20:55:00.000Z",
                "duration": 3600,
                "id": "crid:~~2F~~2Fbds.tv~~2F47691029,imi:001000000020F576",
                "type": "single",
                "title": "Ice Bear",
                "recordingState": "recorded",
                "channelId": "0059",
                "technicalDuration": 3600,
                "seasons": [],
                "poster": {
                    "type": "HighResPortrait"
                },
                "viewState": "notWatched",
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "single",
                "position": 0,
                "startTime": "2018-02-01T17:05:00.000Z",
                "duration": 1500,
                "id": "crid:~~2F~~2Fbds.tv~~2F50823925,imi:00100000001F61D9",
                "type": "single",
                "title": "Chasing Classic Cars",
                "recordingState": "recorded",
                "episodeNumber": 24,
                "seasonNumber": 5,
                "channelId": "0020",
                "technicalDuration": 1500,
                "seasons": [],
                "showId": "crid:~~2F~~2Fbds.tv~~2F27792252",
                "episodeTitle": "Hidden Treasures",
                "poster": {
                    "type": "HighResPortrait"
                },
                "viewState": "notWatched",
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "single",
                "position": 0,
                "startTime": "2018-02-01T17:00:00.000Z",
                "duration": 3600,
                "id": "crid:~~2F~~2Fbds.tv~~2F265787269,imi:001000000020F57A",
                "type": "single",
                "title": "World's Weirdest Pets",
                "recordingState": "recorded",
                "channelId": "0059",
                "technicalDuration": 3600,
                "seasons": [],
                "poster": {
                    "type": "HighResPortrait"
                },
                "viewState": "notWatched",
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "single",
                "position": 0,
                "startTime": "2018-02-01T16:00:00.000Z",
                "duration": 3600,
                "id": "crid:~~2F~~2Fbds.tv~~2F36264178,imi:001000000020F57B",
                "type": "single",
                "title": "World's Creepiest Killers",
                "recordingState": "recorded",
                "channelId": "0059",
                "technicalDuration": 3600,
                "seasons": [],
                "poster": {
                    "type": "BoxCover"
                },
                "viewState": "notWatched",
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "show",
                "position": 0,
                "startTime": "2018-02-01T15:55:00.000Z",
                "duration": 3600,
                "id": "crid:~~2F~~2Fbds.tv~~2F105198417,imi:001000000020BD11",
                "type": "single",
                "title": "Natuur op 2",
                "recordingState": "recorded",
                "channelId": "0065",
                "technicalDuration": 3600,
                "seasons": [],
                "showId": "crid:~~2F~~2Fbds.tv~~2F38739884",
                "episodeTitle": "Great Barrier Reef",
                "poster": {
                    "type": "BoxCover"
                },
                "viewState": "notWatched",
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "single",
                "position": 0,
                "startTime": "2018-02-01T15:20:00.000Z",
                "duration": 1920,
                "id": "crid:~~2F~~2Fbds.tv~~2F275374368,imi:0010000000209EDF",
                "type": "single",
                "title": "NOS Beatrix 80",
                "recordingState": "recorded",
                "channelId": "0062",
                "technicalDuration": 1620,
                "seasons": [],
                "poster": {
                    "type": "BoxCover"
                },
                "viewState": "notWatched",
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "single",
                "position": 0,
                "startTime": "2018-02-01T15:15:00.000Z",
                "duration": 3300,
                "id": "crid:~~2F~~2Fbds.tv~~2F166088897,imi:00100000001F61D7",
                "type": "single",
                "title": "Outback Truckers",
                "recordingState": "recorded",
                "episodeNumber": 5,
                "seasonNumber": 3,
                "channelId": "0020",
                "technicalDuration": 3300,
                "seasons": [],
                "showId": "crid:~~2F~~2Fbds.tv~~2F114808612",
                "poster": {
                    "type": "HighResPortrait"
                },
                "viewState": "notWatched",
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "single",
                "position": 0,
                "startTime": "2018-02-01T15:00:00.000Z",
                "duration": 600,
                "id": "crid:~~2F~~2Fbds.tv~~2F278764615,imi:001000000020BD13",
                "type": "single",
                "title": "NOS Journaal",
                "recordingState": "recorded",
                "channelId": "0065",
                "technicalDuration": 600,
                "seasons": [],
                "showId": "crid:~~2F~~2Fbds.tv~~2Fs36256955",
                "poster": {
                    "type": "BoxCover"
                },
                "viewState": "notWatched",
                "isLocked": false,
                "isAdult": false
            },
            {
                "source": "single",
                "position": 0,
                "startTime": "2018-01-30T17:48:00.000Z",
                "duration": 2940,
                "id": "crid:~~2F~~2Fbds.tv~~2F277591188,imi:00100000001EF6CA",
                "type": "single",
                "title": "Africa's Deadliest",
                "recordingState": "recorded",
                "episodeNumber": 2,
                "seasonNumber": 4,
                "channelId": "0059",
                "technicalDuration": 2940,
                "seasons": [],
                "showId": "crid:~~2F~~2Fbds.tv~~2F175710150",
                "episodeTitle": "Mob Rule",
                "poster": {
                    "type": "HighResPortrait"
                },
                "viewState": "notWatched",
                "isLocked": false,
                "isAdult": false
            }
        ],
        "size": 18
    },
    "bookings": {
        "total": 4,
        "data": [
            {
                "source": "show",
                "id": "crid:~~2F~~2Fbds.tv~~2F226637817",
                "type": "season",
                "title": "How It's Made: Dream Cars",
                "recordingState": "planned",
                "channelId": "0020",
                "mostRelevantEpisode": {
                    "startTime": "2018-02-12T12:10:00.000Z",
                    "endTime": "2018-02-12T12:35:00.000Z",
                    "seasonNumber": 4,
                    "episodeNumber": 5,
                    "duration": 1500,
                    "recordingState": "planned",
                    "viewState": "notWatched",
                    "pinProtected": false,
                    "id": "crid:~~2F~~2Fbds.tv~~2F208714652,imi:001000000021B70C",
                    "seasonId": "crid:~~2F~~2Fbds.tv~~2F226637817",
                    "technicalDuration": 1500
                },
                "seasons": [],
                "showId": "crid:~~2F~~2Fbds.tv~~2F138877699",
                "poster": {
                    "type": "BoxCover"
                },
                "viewState": "notWatched",
                "isAdult": false
            },
            {
                "source": "show",
                "id": "crid:~~2F~~2Fbds.tv~~2Fs45806467",
                "type": "show",
                "title": "Noord Vandaag",
                "recordingState": "planned",
                "channelId": "0191",
                "mostRelevantEpisode": {
                    "startTime": "2018-02-12T17:00:00.000Z",
                    "endTime": "2018-02-12T17:22:00.000Z",
                    "duration": 1320,
                    "recordingState": "planned",
                    "viewState": "notWatched",
                    "pinProtected": false,
                    "id": "crid:~~2F~~2Fbds.tv~~2F721147410,imi:00100000002193AA",
                    "technicalDuration": 1320
                },
                "seasons": [],
                "poster": {
                    "type": "HighResPortrait"
                },
                "viewState": "notWatched",
                "isAdult": false
            },
            {
                "source": "show",
                "id": "crid:~~2F~~2Fbds.tv~~2Fs109720500",
                "type": "season",
                "title": "2Doc",
                "recordingState": "planned",
                "channelId": "0065",
                "mostRelevantEpisode": {
                    "startTime": "2018-02-12T19:25:00.000Z",
                    "endTime": "2018-02-12T20:25:00.000Z",
                    "duration": 3600,
                    "recordingState": "planned",
                    "viewState": "notWatched",
                    "pinProtected": false,
                    "id": "crid:~~2F~~2Fbds.tv~~2F280153704,imi:0010000000232C70",
                    "seasonId": "crid:~~2F~~2Fbds.tv~~2Fs109720500",
                    "technicalDuration": 3600
                },
                "seasons": [],
                "showId": "crid:~~2F~~2Fbds.tv~~2F109720500",
                "poster": {
                    "type": "HighResPortrait"
                },
                "viewState": "notWatched",
                "isAdult": false
            },
            {
                "source": "show",
                "id": "crid:~~2F~~2Fbds.tv~~2Fs37394892",
                "type": "show",
                "title": "NOS Tekst tv",
                "recordingState": "planned",
                "channelId": "0065",
                "mostRelevantEpisode": {
                    "startTime": "2018-02-13T01:55:00.000Z",
                    "endTime": "2018-02-13T05:20:00.000Z",
                    "duration": 12300,
                    "recordingState": "planned",
                    "viewState": "notWatched",
                    "pinProtected": false,
                    "id": "crid:~~2F~~2Fbds.tv~~2F280152074,imi:0010000000232C78",
                    "technicalDuration": 12300
                },
                "seasons": [],
                "poster": {
                    "type": "BoxCover"
                },
                "viewState": "notWatched",
                "isAdult": false
            }
        ],
        "size": 4
    },
    "isAdultContentAvailable": false
}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Andrey Pokhilko

unread,
Feb 12, 2018, 8:22:13 AM2/12/18
to codenam...@googlegroups.com

In that JSON, I see no "meta" mention. So nothing matches your JSON expression.


Andrey Pohilko
Chief Scientist
P: +7 (909) 631-21-69
BlazeMeter Inc.
12.02.2018 15:57, nidhi.t...@gmail.com пишет:

grey....@gmail.com

unread,
Feb 13, 2018, 1:05:22 AM2/13/18
to codename-taurus
Hi.
I recommend you to use Debug Sampler to watch variables and its values. 
I guess the problem is caused by the name of your variable. Actually it isn't 'status_code', but 'status_code_1', 'status_code_2', ... 
It happens because you don't use 'match-no' parameter (of extract-jsonpath config block) and extractor tries to extract array - default value of match-no is '-1'. Maybe you should set it to 0 (random) or 1

---
Taras

ukawat...@gmail.com

unread,
Feb 14, 2018, 10:35:54 AM2/14/18
to codename-taurus
the Problem is arising in the variable substitution 
for example : I have taken response from one API and store in variable "sample" (value of "sample" variable : 45
there is no case of match parameter : (like it will come sample_1 or sample_2)
Now if I am using the variable with URL :
  while running the yml script in taurus : substitution is not working  so 
Output:
Expected:

this yml file is created from jmx file, that jmx file is substituting the value of variable "sample" and providing  output http://ipaddress/45
Does anyone has any solution?

 
 

grey....@gmail.com

unread,
Feb 15, 2018, 12:56:01 AM2/15/18
to codename-taurus
Hi. 
I recommend you to start new thread and explain your question in another words.
Please add reproducible config too.
---
Taras

she...@trunkplatform.com

unread,
Apr 4, 2018, 8:39:22 AM4/4/18
to codename-taurus
"default value of match-no is '-1'. Maybe you should set it to 0" <-- this definitely solved my problem. Many thanks!!!

Andrey Pokhilko

unread,
Apr 4, 2018, 8:49:25 AM4/4/18
to codenam...@googlegroups.com

Next version of Taurus will have default match-no=0, FYI

--

Andrey Pokhilko
Open Source Initiatives Leader
CA
          BlazeMeter

04.04.2018 15:39, she...@trunkplatform.com пишет:
CAUTION: This email originated from outside of CA. Do not click links or open attachments unless you recognize the sender and know the content is safe.

--
You received this message because you are subscribed to the Google Groups "codename-taurus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codename-taur...@googlegroups.com.

she...@trunkplatform.com

unread,
Apr 4, 2018, 7:38:37 PM4/4/18
to codename-taurus
Thank you for the information! I'm a big fan of Taurus and BlazeMeter.
I have struggled a lot yesterday with the doc around jsonPath and env Var inside scenarios. At the end of the day they both would work. it's just that the documentation isn't specific enough. Will contribute via github pull request with my findings too. Cheers.
Reply all
Reply to author
Forward
0 new messages