Reputation: 535
Apologees if this is something fundamental which I should already know. I've got a test set up in jmeter using a Json Extractor. The data which it is extracting is in the format:
"data item 1", "data item 2", "data item 3"
The problem I have is that the extractor is pulling the data out and removing the spaces.
Is this normal? Or is there a setting I need to tweak to stop it doing this?
The service under test is using a Swagger page as a front end and the output from the service is in the format I describe above.
I can alter my expected results to remove all the spaces, but this may cause issues further down the line.
Any help much appreciated. Thanks.
Upvotes: 1
Views: 2134
Reputation: 879
I am assuming following is the JSON response
{
key1: "data item 1",
key2: "data item 2",
key3: "data item 3"
}
Now I am extracting Key1 value using
1. Regular expression extraction
2. JSON Extractor
Both "Post processor" are never going to strip the spaces between words
Examples:
Actual Value: data item 1
Your assumed Extracted Value : dataitem1
JMeter Extracted Value: data item 1
JMeter never going to strip the actual extracted values.Below is the examples.
Jmeter "Http Sampler" has two "Post processor" as child for demo purpose, and sampler uses following json url https://raw.githubusercontent.com/mcheepati/api/master/demo.json .Shown below
After running the test , following are extracted values (Debug sampler used for this)
For reference , please download source jmx file execute in your load Jmeter 3.1, Link
Upvotes: 2