0
votes

I am new with Jmeter. I want to get value from response and use it in another sampler. I did following step but it alway return default value. First I test my regEx with RegTester and I got the result enter image description here

And below is my config in Regular Expression Extractor enter image description here

And I try to check the result in another sampler but it return default value enter image description here

enter image description here

Please help me on this issue

1

1 Answers

1
votes

You need to switch "Response Field to Test" to Text Response

As per Response Assertion documentation:

Text Response - the response text from the server, i.e. the body, excluding any HTTP headers.

Document (text) - the extract text from various type of documents via Apache Tika (see View Results Tree Document view section).

So "Document (text)" needs to be used when you're downloading i.e. auto-generated file and want to check that the file contains a certain phrase.

See How to Use JMeter Assertions in Three Easy Steps article for comprehensive information on using Assertions in JMeter tests.


It might be more handy to use JSON Path PostProcessor which is available since JMeter 3.0. It simplifies working with JSON data as JSONPath language is much easier than Perl5-style regular expressions, especially when it comes to getting separate values from multiple lines or conditional selection (i.e. "get all SKU where virtual stocks > 10".