1

I have a jmeter test for laravel application, the question is why every page i get from http request sampler have a same csrf-token (_token)

this is my jmeter structure

enter image description here

first i want get token from home page for post in login page enter image description here

after that I tried to log in using "post login" http request and succeed,

but when i want to get new token in "shopping cart page" why i get the same token like this :

enter image description here

so when i want to post a new http request with token, what i get is like this : enter image description here

can someone help me how to make the "shoppig cart page" generate a new token for post new htpp request ?

Rizal Sidik
  • 979
  • 6
  • 17

1 Answers1

0

Your setup is not corresponding to JMeter Scoping Rules, if you place Regular Expression Extractors at the same level as HTTP Request samplers the Regular Expression Extractors will be applied to all HTTP Request samplers one-by-one.

Try moving the extractors as children of the HTTP Requests, this way their scope will be limited to the current sampler only and the variable value will not be overwritten by the subsequent executions.

enter image description here

Also be aware that using Regular Expressions to parse HTML is not the best idea, consider using CSS Selector Extractor instead.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133