jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <shet...@gmail.com>
Subject Re: Help With a Null Variable
Date Thu, 12 Nov 2009 18:00:46 GMT
hi
you could do this at the beanshell level
//check the number of brackets , this is pseudo code, also check that
loopBatch always has a value that is the string //representation of an
integer or an integer

if(vars.get("BatchLink_g3")) == null ||
"".equals(vars.get("BatchLink_g3")).trim())){
   vars.put("loopBatch","0");
} else {
       vars.put("loopBatch", vars.get("BatchLink_g3"));
}


OR
 You could do it as a javascript funtion (null means the value remains as
${loopBatch} and you'd have to pass it as a string so there be quotes around
the ${loopBatch}



regards
deepak




On Thu, Nov 12, 2009 at 9:38 AM, Steve Eckhart
<Steve.Eckhart@wausaufs.com>wrote:

> I have a Regular Expression which is reading a variable from a web page.  I
> need to test this value to see if I should perform the next step or perform
> another search.
>
> Currently, I have the following in a BeanShell PostProcessor to set the
> value of the variable:
>
>        vars.put("loopBatch", vars.get("BatchLink_g3"));
>
> If my search returned no results, a Debut PostProcessor will report
> loopBatch=null. Then, the If Controller ${loopBatch} > 0 generates an error:
>
>        ERROR - jmeter.control.IfController: missing ) after argument list
> (<cmd>#1)
>
> How can I test using a variable which might be null? I found a method of
> the Class Abstract Property getIntValue() which would give me what I want (0
> when the value is null), but I don't understand how to use getIntValue() in
> a JMeter script.
>
> Is this the right way to proceed? Am I missing something? I don't know much
> about the BeanShell command.
>
> Thank you for any help.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

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