Bug 51488 - Assertion: Variable name scope is shared among all assertions
Assertion: Variable name scope is shared among all assertions
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.4
PC Windows XP
: P2 normal (vote)
: ---
Assigned To: JMeter issues mailing list
:
: 51255 (view as bug list)
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2011-07-08 09:40 UTC by jens_0
Modified: 2011-07-29 06:34 UTC (History)
2 users (show)



Attachments
New patch to check (1.50 KB, patch)
2011-07-21 20:08 UTC, Milamber
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jens_0 2011-07-08 09:40:49 UTC
In case two assertions (Response assertions) exist in a test tree, the text value in "JMeter Variable" which was last displayed is also shown on other assertions, in case "JMeter Variable" is not selected in "Apply to".

While this is no functional problem, this is awkward as variable names are displayed in other assertions who have nothing to do with them.

Suggested resolution:

ScopePanel.java:
    public void setScopeAll() {
        allButton.setSelected(true);
        variableName.setText("");
    }

    public void setScopeChildren() {
        childButton.setSelected(true);
        variableName.setText("");
    }

    public void setScopeParent() {
        parentButton.setSelected(true);
        variableName.setText("");
    }

    public void setScopeVariable(String value) {
        variableButton.setSelected(true);
        variableName.setText(value);
    }
    }
Comment 1 Milamber 2011-07-11 17:30:19 UTC
*** Bug 51255 has been marked as a duplicate of this bug. ***
Comment 2 Milamber 2011-07-11 17:42:41 UTC
Thanks for your suggested resolution.
Fixed.

URL: http://svn.apache.org/viewvc?rev=1145254&view=rev
Log:
Bug 51488 - Assertion: Variable name scope is shared among all assertions (and Bug 51255)

Modified:
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/SizeAssertionGui.java
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/gui/RegexExtractorGui.java
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/AbstractScopedJMeterGuiComponent.java
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/ScopePanel.java
    jakarta/jmeter/trunk/xdocs/changes.xml
Comment 3 jens_0 2011-07-21 13:24:02 UTC
This introduces a problem (Nullpointerexception) in case variableName is null (enableVariableButton = false in constructor).

This is the case for example with durationAssertion. 
We need to add
 if (variableName != null)
to setScope...
Comment 4 Milamber 2011-07-21 20:08:36 UTC
Created attachment 27308 [details]
New patch to check

Hello,

This patch corrects the NPE for you?

Milamber
Comment 5 jens_0 2011-07-22 11:57:26 UTC
Hi Milamber,

I don't think so.

setScopeVariable is probably only called on elements which have this.

My change was:
    public void setScopeAll() {
        allButton.setSelected(true);
        if (variableName != null)
        	variableName.setText("");
    }

    public void setScopeChildren() {
        childButton.setSelected(true);
        if (variableName != null)
        	variableName.setText("");
    }

    public void setScopeParent() {
        parentButton.setSelected(true);
        if (variableName != null)
        	variableName.setText("");
    }
Comment 6 Milamber 2011-07-22 17:04:30 UTC
Hello Jens, 

I thinks you use a old revision of ScopePanel?

Since first close of this bug, ScopePanel has changed
URL: http://svn.apache.org/viewvc?rev=1145254&view=rev

I used enableVariableButton like the constructor method to keep harmony to resolve the orignal bug.

Have you a more details logs for the NPE?
Comment 7 jens_0 2011-07-29 06:34:37 UTC
Ok that should work also.