Q: Recorded Scripts in JMeter doesn't make an order due to csrf token in URL Using Jmeter GUI, I recorded a test scenario (placing an order) and the script ran successfully. But when I replay the test scripts it doesn't function as it was recorded to do, it did not make an order. 
After query the dev, found that with each item selected, the server generate a CSRF token, and put the token in the URL path (Like: /cart/add/type/product_id/7245985/_csrf_token/b46c0aec2e5891808ec42141b1956943204ae8f8) when the item is added to the shopping cart. This is all recorded in the script. This path with the token is used to add the item to cart. 
My question is how to test this dynamic token when it is concatenated in the path of URL?
Any help are appreciated.

A: If you have not already added Tree View Listener to your Test Plan, then add it now. You can use it to view the details of requests & responses. JMeter considers a request successful if it gets "some" response from Server-side. It does not matter if the response is functionally valid or not. So, in order to make sure that JMeter is sending valid parameters and receiving expected response, you will have to check the details of requests / responses in Tree view listener.
You can also add Response Assertions to requests so JMeter itself verifies that it is getting expected responses. 
Important Tips:


*

*Use TreeView Listener for debugging only. In real load test keep it disabled as it consumes lot of memory.

*Do not use response assertions excessively as they consume lot of memory as well.

*JMeter is not a browser-based tool. It just deals with back-end requests. Hence it is expected to be very fast. So nothing wrong with that. You should remove un-necessary timers as there is nothing wrong with it being fast.

*If your requests involve some kind of login authorization then have a look at this question for further details Load testing using jmeter with basic authentication

A: Recording doesn't guarantee working script, it gives you only a "skeleton" and usually you need to perform some correlation (the process of extracting mandatory dynamic parameter from previous response and adding it to the next request). 
Reference material:


*

*Building a Web Test Plan

*Building an Advanced Web Test Plan

*How to use JMeter for Login Authentication?

*How to make JMeter behave more like a real browser
