Shadin Shadin - 1 year ago 197
Apache Configuration Question

JMeter BeanShell Assertion comparison

I don't understand my BeanShell Assertion response in Apache JMeter.

int varcount = Integer.parseInt(vars.get("getcount"));
if ((varcount) < 25000) {
Failure = true;
FailureMessage = "testnsg";

value is 39000. I need to be alerted and the test to be stopped when it is below 25000. However, above script is running fine without any errors, and when I change the comparison to
((varcount) > 25000)
then i get an alert and the result is"

Assertion error: false
Assertion failure: true
Assertion failure message: testnsg

It's the opposite of what I would expect. Any idea?

Answer Source

The behaviour is absotuely expected. 39000 is more than 25000 hence your assertion never fails.

Beanshell comparison operators


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download