Reputation: 1149
I need to fetch some data for my testing. I want to extract:
Thread group name + Sample name, and then use in another sample, as sample name. I am aware that using JSR223 i can get: Thread name as:
String groupName = ctx.getThreadGroup().getName();
log.info(groupName);
But, is there some Jmeter function that can help me to achieve that, so i can use for every single sampler, without the usage of JSR223?
ex: If my Thread group name is: token call, and my sampler name is, Get Token, how to use in the, second sampler? expected output to be something like: get first request - token call - Get Token
Upvotes: 0
Views: 2015
Reputation: 694
By default you can get the current sampler's name and current thread group's name using the following in-built JMeter functions
Current thread group name -> ${__threadGroupName}
Current sampler name -> ${__samplerName()}
Within the sampler name function you can store it into a variable and reuse it in subsequent places
${__samplerName(previousSamplerName)}
However, the problem is you might not have any place within your sample to actually get your sampler's name and store it because there is no processor element out of the box that helps in giving a placeholder to execute such things (apart from Beanshell and JSR223).
Hence my suggestion is to use the plugin based post processor "Dummy Subresult" to your sampler and then fetch the current sample's name and store it in a variable. This comes as part of the Dummy Sampler plugin.
Plugin download link: https://jmeter-plugins.org/wiki/DummySampler/
Reference Screenshots
Hope this helps!
Upvotes: 1