i have this scheme in JMeter:
Get the balance value (GET) put in var mainBalance
Place a recharge (POST)
Verify resulted balance (GET) - put in var updatedBalance such as updatedBalance is mainBalance + 10$
All values must be type float.
Im stuck at the last step: I've put a BeanShell assertion but doesn't work. It think that i get the values in the wrong way and also i don
t do the calculation as JMeter wants. I also tried with vars.get(String.valueOf("mainBalance"))
float a = new float(vars.get("mainBalance"));
float b = new float(vars.get("updatedBalance"));
if(b != (a + 10)) {
Failure = true;
}
This is the log error:
Assertion error: true Assertion failure: false Assertion failure message: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval In file: inline evaluation of: ``float a = new float("mainBalance"); float b = new float("updatedBalance"); if(b . . . '' Encountered "(" at line 1, column 20.