0
votes

My Jmeter test plan is setting a token variable using a Regular Expression Extractor (a Post-Processor element), but upon a while this variable is not expanded in its value and as consequent ${token} is sent to the REST API under actual test.

I added Constant Delay Timer elements in between each request a user (thread) sends and it seems to overcome the problem to a great extend but not entirely. I still get some Bad Request from the API side.

I provide a screen capture

enter image description here

And a second screen capture showing the full test plan (or a large portion of it)

enter image description here

Can someone please explain why this happening and somehow resolve it ?

1
Are you using multiple Thread Groups? In which Thread Group you are extracting ${token}? Paste screen shot of whole Test Plan for understanding - SAIR
There may be issue with your regular expression extractor, please post the details where you are fetching the token and passing it to the next request. - Zohair
I'm using one Thread Group @SAIR. I'm getting the token from the response headers (POST login sampler) and I think it is inevitable to use Regular Expression Extractor. I already edited and added another screen capture. Thanks in advance. - dpesios

1 Answers

1
votes

It might be the case your Regular Expression Extractor fails to find the value therefore it falls back to the default (undefined) value of ${token}

My expectation is that under the load your application cannot properly respond, to wit response doesn't contain the token. You can double check it using Debug Sampler and View Results Tree listener combination.

You can temporarily enable saving of response data by adding the next lines to user.properties file:

jmeter.save.saveservice.output_format=xml
jmeter.save.saveservice.response_data=true

and next time you run your test in command-line non-GUI mode JMeter will keep response data for all samplers. You should be able to examine the responses and add a Response Assertion to ensure that the token is present in the POST LOGIN sampler response data