I am performing a search request in jmeter. So my test plan flow is home then login then product catalogue and then search. I tried to make a post request for search but it failing all the time. I used a CSV file so each time the query is changed. But then I used a get request and used the query variable in the search path like this search?query=${search_input}and then it passed but when i checked the html it is not the correct page. In the html response I also see this {{noSearchResults.query}}'. But if i put the url on the browser it works fine. Can you please help me with this?
Asked
Active
Viewed 372 times
1 Answers
0
Double check that your
${search_input}
variable has the anticipated value using Debug Sampler and View Results Tree listener combinationIt might be the case that your
${search_input}
variable contains special characters which need to be URL-encoded so you might need to wrap the variable into __urlencode() function like:search?query=${__urlencode(${search_input})}
JMeter automatically treats responses with status code below 400 as successful, if you need to add an extra layer of check for presence of the results or absence of
{{noSearchResults.query}}
- use Response Assertion

Dmitri T
- 159,985
- 5
- 83
- 133
-
Hi Dimitri thanks for the answer. i tried the unicode function but still the same. But then I checked the page source of the real website and search for {{noSearchResults.query}} and it also there as well. So i guess my request going okk!!! – Rickshaw Tomtom Aug 19 '21 at 10:38