Reputation: 1237
I try to move a User Defined variable to variable in beanshell sampler. (I need the User defined variable to be part of a bigger string.)
When I try to move it, or make a copy of it I get error 500
can someone please advise how can I put the value of user defined field in bean-shell variable and than use it (not need to change the user defined variable just want it value)
In this script I Want to put the value of $Expected_Offer_ID to String variable Expected_Offer
Upvotes: 2
Views: 10671
Reputation: 167992
There are (at least) 2 options:
${Expected_Offer_ID}
to "Parameter" section of the Sampler. You will be able to access it as Parameters
in your scriptvars.get("Expected_Offer_ID);
where required. vars
is a shorthand to JMeterVariables class instance, it provides read/write access to all JMeter VariablesRemember 2 things:
${myVar}
, either use aforementioned "Parameters" section or code-based equivalents as they might resolve into something which can cause script interpretation failure or unexpected behaviour. Moreover, in case of Groovy language it prevents compiled scripts cachingUpvotes: 6
Reputation: 58774
JMeter variables are accessed through vars
object, use:
String Expected_Offer = vars.get("Expected_Offer");
Upvotes: 3