0
votes

I'm using JMeter 3.1 to run a http-endpoint test & I need to extract a very small portion of the return JSON I receive.

I'm using the JSON Extractor postprocessor element & JSONPath expressions to find my value. This post does a really good job of explaining how to assign the value I'm looking for to a runtime variable.

However it stops short of explaining how to save said variable to an output file. I can check to make sure that I've pulled the data using an assertion rule; I can even save the true/false value of that check. Saving the variable itself however, seems less straightforward.

I have 3 ideas and am likely going to spend the next few hours exploring them & checking this thread. So,

Will any of these work?:

  • Figure out what "Sub Results" means to JMeter and see if I can get my JSON snippet there.
  • Make another sampler that (somehow) just reads & returns a variable I pass it at runtime, whenever a thread executes.
  • Figure out if "Assertion Results" is capable of saving anything other than "TRUE" or "FALSE."
  • While we're at it, I'm going to see what these friggin mean'

Here's an image!

1
Refer this link to save the variable to output file. stackoverflow.com/questions/43012958/…NaveenKumar Namachivayam

1 Answers

2
votes

Add the next lines to user.properties file (located in "bin" folder of JMeter installation)

jmeter.save.saveservice.output_format=xml
sample_variables=YOUR_VARIABLE_NAME_HERE

Next time you run your test you will see your variable value appended to .jtl results file.

Reference material: