Reputation: 13
I have prepared a JMeter script.
It has multiple requests. I fetch data from the response and use it as a parameter for the next request.
i.e.
It works perfectly fine with a single thread. But, when I run the script for multiple threads, it is not working properly.
i.e.
In Request 5 it tries to delete already deleted item, hence failing. This runs in a very random way.
Please help.
Upvotes: 1
Views: 795
Reputation: 168147
It is working as expected. If you edit and delete the same item with different threads the first thread which comes to executing delete request will remove it and others will fail.
It should go like this:
You can use __threadNum() function as i.e. postfix to uniquely address ID of the item created by a specific thread. For instance ID_1
variable will hold ID of the item, created by 1st thread, ID_2
- by 2nd thread, etc.
You can refer variables using dynamic thread numbers using __V() function like:
${__V(ID_${__threadNum})}
See Functions and Variables chapter of JMeter's User Manual and How to Use JMeter Functions posts series for more information on above and others JMeter functions.
Upvotes: 1