Reputation: 79
In the snippet shown below data and data1 are set from different JMeter SampleResult Responses. The challenge which I am facing is during the processing of value1, I require the data from value which is present in another class.
The value is coming from the response of JMeter SampleResult(say 1), whereas the data1 is coming from the response of JMeter SampleResult(say 2).
I am also using a validate file for BeanShell assertions which only processes the response of JMeter SampleResult 2 for validation purposes.
How can I get the data from value to use it for further calculations of value1?
Class C is an abstract class
class A extends C {
@Override
public String processValue() {
****Some code written here****
value = getValue();
****Calculation of result done here****
return result;
}
@Override
public void setData(Object data) {
this.data=(typecast)data;
}
private String getValue() {
****logic written here****
return value;
}
}
value1 requires value from Class A for it's processing
class B extends C {
@Override
public String processValue() {
****Some code written here****
return value1;
}
@Override
public void setData(Object data1) {
this.data1=(typecast)data1;
}
}
data1 and data are typecasted into different types
Upvotes: 0
Views: 248
Reputation: 58774
In JMeter you can put different objects in JMeterVariables as put:
JMeterVariables vars = JMeterContextService.getContext().getVariables();
vars.putObject("data1", data1);
vars.putObject("data", data);
and get:
vars.getObject("data1");
vars.getObject("data");
Upvotes: 1