Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
163 views
in Technique[技术] by (71.8m points)

How to save 10 different id from Jmeter response and use it in next 10 requests

I am currently running 10 different threads like this:

each of the thread response will provide a different id in the response and i want to save them and use it as a request in the next test case(10 threads) so there will be 10 ids and 10 threads and each thread will have a unique id as a request. This is what I am doing:

Here is the first request

This is how I am extracting the values

This is how i am using the final request however i am not able to get the desired results

UPDATE:

I tried Dmitri Answer but still no luck i am extracting the id by using this

I used __threadNum() function as the prefix or postfix for the property name like:

${__setProperty(loginassistant_${__threadNum},${loginassistant_},)}

and read it similarly:

${__P(loginassistant_${__threadNum},)}

but it is not working and it is setting the value as a static string(see screenshot below):

This is how and where i am defining my loginassistant using the simple controller:

question from:https://stackoverflow.com/questions/65945297/how-to-save-10-different-id-from-jmeter-response-and-use-it-in-next-10-requests

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You're using properties which are global, if you have more than one thread the next thread will overwrite the property defined by the previous thread so it could be mismatch.

If you don't need to pass values across thread groups - go for JMeter Variables instead, variables are local to the thread (virtual user) and the properties are global for the whole JMeter/JVM instance

If you do need to pass values across thread groups - either use __threadNum() function as the prefix or postfix for the property name like:

${__setProperty(loginassistant_${__threadNum},${loginassistant},)}

and read it similarly:

${__P(loginassistant_${__threadNum},)}

or go for Inter-Thread Communication Plugin


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...