Reputation: 5543
I'm trying to implement Load Test test script, which should act according to the scenario:
there would be several "producer" threads, which would upload files to database via web service;
there would be few "consumer" threads, which will download files uploaded by "producers".
Currently, I'm stuck on database clean up. I can obtain record ID using JSON extractor after sending "producer" request, and use this ID to simulate file download. But this ID isn't visible inside the Tear Down Thread Group.
Could you tell me, how I can pass value from Thread Group which uploads file to Tear Down Thread Group?
Currently, my JMeter 4 project use objects with following configurations:
Upvotes: 0
Views: 1783
Reputation: 168122
As per JMeter User Manual:
Properties are not the same as variables. Variables are local to a thread; properties are common to all threads, and need to be referenced using the __P or __property function.
So you have to go for JMeter Properties to pass the values between Thread Groups, like:
Example setting property:
${__setProperty(foo_${__threadNum},${YOUR_VARIABLE_HERE})}
Example getting property:
${__P(foo_${__threadNum},)}
Demo:
More information: Knit One Pearl Two: How to Use Variables in Different Thread Groups
Upvotes: 1
Reputation: 58812
JMeter variables can't be shared between Thread groups (include TearDown),
You can copy variable value to JMeter property and use it in Tear Down, for example inside JSR223 Sampler
props.put("id_to_delete", vars.get("id_to_delete"));
or use __setProperty function to copy value to property:
${__setProperty(id_to_delete, ${id_to_delete},)}
Upvotes: 1