ATLANTBH / jmeter-components

Apache jMeter components
Apache License 2.0
78 stars 51 forks source link

JSON Path Extractor : Invalid Path (v 1.1.2) #7

Closed Fiat500L closed 10 years ago

Fiat500L commented 10 years ago

When the JSON path is not available the Name (variable) is carrying on a previous valid path.

Example, path $.returned is not always available on the JSON response, so a first valid path sets the variable, let say to 100, if the next JSON response doesn't have "returned" the variable will keep 100, even the path is invalid.

bjusufbe commented 10 years ago

If I understood your issue correctly, following happens:

  1. First JSON path extractor extracts the value (VALUE) to same variable called (for example) TEST
  2. Second JSON path extractor tries to extract the value to same variable TEST but it fails because JSON response is not always returned
  3. In further part of the test, TEST variable still equals to the VALUE instead of being null or something like that?
Fiat500L commented 10 years ago

Hy,

  1. First JSON path extractor extracts the value (VALUE) to same variable called (for example) TEST, for example TEST = 100 (where attribute X is available on the JSON response),
  2. Second JSON path extractor tries to extract the value to same variable TEST but it fails because , I have a valid JSON response, but the attribute is not available, so TEST continues to be 100.
  3. TEST will continue to be 100 until I have again a JSON response where my JSON attribute is available, and will change, for example to 1,245 . My scenario is kind of atypical because my JSON response is not always the same, I.e. the attribute I am trying to extract is not always present, since my JSON service can handle multiple kind of requests, with multiples JSON attributes structures.

So, what I expected:

  1. TEST = 100
  2. attribute to be extracted , not present, TEST = null Regards,

M

From: bjusufbe notifications@github.com Reply-To: ATLANTBH/jmeter-components <reply+i-21930939-bd2a5500ecd80079df79a7cd98fab31b78a089f1-5826838@reply.git hub.com> Date: Friday, November 1, 2013 at 5:15 AM To: ATLANTBH/jmeter-components jmeter-components@noreply.github.com Cc: "Mario T. Arruda" mario.arruda@verizon.net Subject: Re: [jmeter-components] JSON Path Extractor : Invalid Path (v 1.1.2) (#7)

If I understood your issue correctly, following happens:

  1. First JSON path extractor extracts the value (VALUE) to same variable called (for example) TEST
  2. Second JSON path extractor tries to extract the value to same variable TEST but it fails because JSON response is not always returned
  3. In further part of the test, TEST variable still equals to the VALUE instead of being null or something like that? ‹ Reply to this email directly or view it on GitHub https://github.com/ATLANTBH/jmeter-components/issues/7#issuecomment-2755442 8 .
bjusufbe commented 10 years ago

Issue is fixed. You can pull latest code. Let me know if you have any issues