jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RL <l...@mindspring.com>
Subject Re: Using Beanshell Assertion to test a JSON value
Date Sat, 21 Dec 2013 01:01:17 GMT
Thanks. That example did have errors. Here's what I just tried:

String blobValue = vars.get("blobValue");

if (blobValue.length() > 0  && blobValue != 0 ){
 Failure = true;
 FailureMessage = "blobValue was " + blobValue + ".";
}
else{
  Failure = false;
}

When I execute this I get these errors:

2013/12/20 16:56:04 ERROR - jmeter.util.BeanShellInterpreter: Error
invoking bsh method: eval    Sourced file: inline evaluation of: ``
String blobValue = vars.get("blobValue");  if (blobValue.length() > 0  &&
blo . . . ''
2013/12/20 16:56:04 WARN  - jmeter.assertions.BeanShellAssertion:
org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval
Sourced file: inline evaluation of: ``   String blobValue =
vars.get("blobValue");  if (blobValue.length() > 0  && blo . . . ''

I was trying to catch them with the try/catch block.

The issue is that blobValue may not exist if JSON Path Extractor won't
create a variable for a null value. So the Beanshell script has to deal
with the cases where:

- the variable doesn't exist
- the variable exists and is null
- the variable exists and is not null

Currently it's crashing on the first case, I think.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message