Skip to content

Instantly share code, notes, and snippets.

@vinsguru
Last active December 26, 2016 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinsguru/ba9b33cb25b56e754a852baa3b1f72e0 to your computer and use it in GitHub Desktop.
Save vinsguru/ba9b33cb25b56e754a852baa3b1f72e0 to your computer and use it in GitHub Desktop.
@Override
public String execute(SampleResult arg0, Sampler arg1) throws InvalidVariableException {
JMeterVariables vars = getVariables();
String str1 = ((CompoundVariable) values[0]).execute().trim(); //parameter 1
String str2 = ((CompoundVariable) values[1]).execute().trim(); //parameter 2
String delimiter = "";
if(values.length>2){
delimiter = ((CompoundVariable) values[2]).execute(); //parameter 3 - delimiter could be a space - don't trim
}
String result = str1 + delimiter + str2;
//user might want the result in a variable
if( null!=vars && values.length>3){
String userVariable = ((CompoundVariable) values[3]).execute().trim();
vars.put(userVariable, result); //store the result in the user defined variable
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment