You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2017/11/14 18:32:15 UTC

[Bug 61760] New: New function : isVarDefined

https://bz.apache.org/bugzilla/show_bug.cgi?id=61760

            Bug ID: 61760
           Summary: New function : isVarDefined
           Product: JMeter
           Version: 3.3
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Main
          Assignee: issues@jmeter.apache.org
          Reporter: p.mouawad@ubik-ingenierie.com
  Target Milestone: ---

This functions checks if variable isVarDefined

- __isVarDefined(varName)

It would return true or false

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 61760] New function : isVarDefined

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61760

--- Comment #6 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
(In reply to orimarko from comment #5)
> I accept your suggestion and think isPropDefined is a good addition,
> I wanted to point out that __V function code will
> be almost equal to isVarDefined except return true/false instead of the
> value.
> 
> Can __V function be added is defined 2nd parameter, and if it's true return
> true/false instead of the value (default false as now)?

I prefer a more meaningful name in fact. So let's go for a new function.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 61760] New functions : isVarDefined and isProdDefined

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61760

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|New function : isVarDefined |New functions :
                   |                            |isVarDefined and
                   |                            |isProdDefined

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 61760] New function : isVarDefined

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61760

orimarko <or...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |orimarko@gmail.com

--- Comment #1 from orimarko <or...@gmail.com> ---
what about property? should we have another parameter to allow checking is
property defined?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 61760] New function : isVarDefined

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61760

--- Comment #4 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
(In reply to Graham Russell from comment #3)
> I think that in general having flags to change function behaviour can be
> confusing, if they are boolean, what do they mean (when reading the code)
> and if they are strings or something, how do we find out what we should use?
> 

Function Helper Dialog can describe this.
We could use a mode instead of boolean.

> I presume most of the time you don't care if it's a var or property?

Not sure. User may have named by error a property and a variable the same.

> 
> I think that simply, __isDefined(varOrPropName) is best, unless more complex
> knowledge is required.
> 
> If vars and props can have the same name and you care about only the one
> being defined, how about:
> __isVarDefined(name)
> __isPropDefined(name)

Yes, my idea was just to avoid having too many functions.
> 
> or if they cannot have the same name, maybe:
> __isDefined(varOrPropName) - true or false if var or prop is defined
> and

This name is already taken by jmeter-plugins functions.

> __isVar(name) and __isProp(name) if you then care about the difference once
> you've done but this wouldn't work very well if both are defined and you are
> trying to find out which is defined, but that doesn't seem to be the use
> case here anyway.

But intuitively, I would say that this function tells me if name is a property
or a variable, not if it's defined.

So I would end up to the following:

- Option 1 : isVarDefined / isPropDefined
- Option 2 : isSet(MODE, name), where mode is Property, Variable


Except for the additional function I feel Option 1 is better

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 61760] Add "__isPropDefined" and "__isVarDefined" functions to know if property or variable exist

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61760

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #8 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
Author: pmouawad
Date: Sun Nov 19 11:04:53 2017
New Revision: 1815725

URL: http://svn.apache.org/viewvc?rev=1815725&view=rev
Log:
Bug 61760 - Add "__isPropDefined" and "__isVarDefined" functions to know if
property or variable exist
Contributed by Orimarko
Bugzilla Id: 61760

Added:
    jmeter/trunk/src/functions/org/apache/jmeter/functions/IsPropDefined.java  
(with props)
    jmeter/trunk/src/functions/org/apache/jmeter/functions/IsVarDefined.java  
(with props)
    jmeter/trunk/test/src/org/apache/jmeter/functions/TestIsPropDefined.java  
(with props)
    jmeter/trunk/test/src/org/apache/jmeter/functions/TestIsVarDefined.java  
(with props)
Modified:
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/functions.xml

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 61760] New function : isVarDefined

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61760

--- Comment #7 from orimarko <or...@gmail.com> ---
Created attachment 35537
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35537&action=edit
Add patch with 2 functions, tests and xdocs

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 61760] New function : isVarDefined

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61760

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |p.mouawad@ubik-ingenierie.c
                   |                            |om

--- Comment #2 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
(In reply to orimarko from comment #1)
> what about property? should we have another parameter to allow checking is
> property defined?

Don't know if it's really useful , in this case functions should be named:

__isSet(boolean isVar, String varOrProp)

isVar : true or false


Thoughts ?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 61760] New function : isVarDefined

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61760

--- Comment #5 from orimarko <or...@gmail.com> ---
I accept your suggestion and think isPropDefined is a good addition,
I wanted to point out that __V function code will
be almost equal to isVarDefined except return true/false instead of the value.

Can __V function be added is defined 2nd parameter, and if it's true return
true/false instead of the value (default false as now)?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 61760] New function : isVarDefined

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61760

--- Comment #3 from Graham Russell <gr...@ham1.co.uk> ---
I think that in general having flags to change function behaviour can be
confusing, if they are boolean, what do they mean (when reading the code) and
if they are strings or something, how do we find out what we should use?

I presume most of the time you don't care if it's a var or property?

I think that simply, __isDefined(varOrPropName) is best, unless more complex
knowledge is required.

If vars and props can have the same name and you care about only the one being
defined, how about:
__isVarDefined(name)
__isPropDefined(name)

or if they cannot have the same name, maybe:
__isDefined(varOrPropName) - true or false if var or prop is defined
and
__isVar(name) and __isProp(name) if you then care about the difference once
you've done but this wouldn't work very well if both are defined and you are
trying to find out which is defined, but that doesn't seem to be the use case
here anyway.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 61760] Add "__isPropDefined" and "__isVarDefined" functions to know if property or variable exist

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61760

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|New functions :             |Add "__isPropDefined" and
                   |isVarDefined and            |"__isVarDefined" functions
                   |isProdDefined               |to know if property or
                   |                            |variable exist

-- 
You are receiving this mail because:
You are the assignee for the bug.