jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RL <>
Subject Re: Using Beanshell Assertion to test a JSON value
Date Sat, 21 Dec 2013 03:21:53 GMT
Hm. I did a kludgy workaround that seems to work.

I wonder if it's worth reporting as a bug that vars.get crashes if the
specified variable doesn't exist. Surely that would have been well known by

My kludgy solution was to predefine blobValue as -1, then check to see if
it's still -1 after the JSON Path Extraction.

Since this particular parameter should never have a value of -1, if it
still does, that means that the JSON Path Extraction failed because its
value is really null. If the extraction succeeds, it would have a different


Thanks for the help and comments.

On Fri, Dec 20, 2013 at 7:06 PM, RL <> wrote:

> > String blobValue = vars.get("blobValue");
>> what does vars.get() return if the variable does not exist?
> Right. That's what's causing the crash. If I create blobValue explicitly
> beforehand the Beanshell Assertion works.
> So the question more narrowly defined is: how can one test for the
> existence of a variable before doing a vars.get, since vars.get crashes if
> the specified variable doesn't exist?

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