jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: Testing for nullity in IfController
Date Fri, 12 Oct 2012 01:24:20 GMT
On 11 October 2012 21:18, Philippe Mouawad <pmouawad@apache.org> wrote:
> Hello,
> I was wondering if there isn't a better way to do this, which I don't like
> very much.

It's not really testing for null, it's testing whether the variable is
defined or not.

One could use vars.get("myVar") == null in one of the scripting
languages, but that does not seem any better to me, and has more
overhead.

For a simpler syntax one would have to create a function, e.g.
__undefined(myVar)
However one might also need __defined(myVar).

I don't personally that would be worth it; the syntax seems fine to
me, and helps re-inforce what happens when variables are not defined.

> Regards
> Philippe
> On Thu, Oct 11, 2012 at 10:15 PM, <pmouawad@apache.org> wrote:
>
>> Author: pmouawad
>> Date: Thu Oct 11 20:15:36 2012
>> New Revision: 1397277
>>
>> URL: http://svn.apache.org/viewvc?rev=1397277&view=rev
>> Log:
>> Document the way to test for nullity in an IfController
>>
>> Modified:
>>     jmeter/trunk/xdocs/usermanual/component_reference.xml
>>
>> Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml
>> URL:
>> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1397277&r1=1397276&r2=1397277&view=diff
>>
>> ==============================================================================
>> --- jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
>> +++ jmeter/trunk/xdocs/usermanual/component_reference.xml Thu Oct 11
>> 20:15:36 2012
>> @@ -2078,6 +2078,12 @@ setting is reset when a parent Loop Cont
>>                 If you need access to such variables, then select
>> "Interpret Condition as Variable Expression?" and use
>>                 a __javaScript() function call. You can then use the
>> objects "vars", "log", "ctx" etc. in the script.
>>                 </note>
>> +               <note>
>> +               To test a variable for nullity do the following, suppose
>> var is named myVar, expression will be:
>> +               <ul>
>> +                <li>"${myVar}" == "\${myVar}"</li>
>> +                </ul>
>> +               </note>
>>         </description>
>>  <properties>
>>      <property name="Name" required="No">Descriptive name for this
>> controller that is shown in the tree.</property>
>>
>>
>>

Mime
View raw message