You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by Jozef Hovan <ho...@pobox.sk> on 2003/10/13 11:08:19 UTC

Bug in Test Plan editing & solution

Hi,

We are considering to use JMeter as test tool in software development.
Btw we are not very satisfied with status of this project.
We used version JMeter 1.9.1, and we expected project in more stable 
release.

We found some bugs and issues, so I decided to trace this.

-----------------
I found one bug in JMeter. My Java is Sun JDK 1.4.2, I have JMeter version
downloaded from CVS respository.

Scenario of this bug is (after starup):
1. On "Test Plan" create new "Thread Group"
2. Rename "Thread Group" to "foo""
3. On "Test Plan" create new "Thread Group"
4. Rename new created "Thread Group" to "xxx"
5. In Thread Group "xxx" create new "Simple Controller"
Tree now looks like that:
- Test Plan
    - foo
    - xxx
       - Simple Controller

6. Remove Simple Controller from test Plan
   -> Hilighted Node will be node "foo"
   -> if now you click on any other node, data od Thread Group will be 
rewriten <- !!! bug
        so name of node foo is replaced by "xxx"
Tree now looks:
- Test Plan
    - xxx
    - xxx
  
I tracked this scenario, I suggest this changes in source code:

file src/core/org/apache/jmeter/gui/action/Remove.java
original code:
-------------------
    public void doAction(ActionEvent e)
    {
        ActionRouter.getInstance().actionPerformed(
            new ActionEvent(e.getSource(), e.getID(), CheckDirty.REMOVE));
        GuiPackage guiPackage = GuiPackage.getInstance();
        JMeterTreeNode[] nodes =
            guiPackage.getTreeListener().getSelectedNodes();
        guiPackage.getTreeListener().removedSelectedNode();     //set 
current path to parent of current node
        for (int i = nodes.length - 1; i >= 0; i--)
        {
            removeNode(nodes[i]);
        }
        guiPackage.getTreeListener().getJTree().setSelectionRow(1);  // 
set visible node to first node of Test Plan !!! BUG !!!

    }
   
-------------------
suggested change:   
-------------------
    public void doAction(ActionEvent e)
    {
        ActionRouter.getInstance().actionPerformed(
            new ActionEvent(e.getSource(), e.getID(), CheckDirty.REMOVE));
        GuiPackage guiPackage = GuiPackage.getInstance();
        JMeterTreeNode[] nodes =
            guiPackage.getTreeListener().getSelectedNodes();
        TreePath 
newTreePath=guiPackage.getTreeListener().removedSelectedNode();
        for (int i = nodes.length - 1; i >= 0; i--)
        {
            removeNode(nodes[i]);
        }
        
guiPackage.getTreeListener().getJTree().setSelectionPath(newTreePath);

    }
-------------------   
file src/core/org/apache/jmeter/gui/tree/JMeterTreeListener.java
change of method removeSelectedNode to return a currentPath value:
-------------------
    public TreePath removedSelectedNode()
    {
        currentPath = currentPath.getParentPath();
        return currentPath;
    }
-------------------

I'm not sure, if there is not better way to fix this bug, so I don't 
want to send you a patch file.
Could you have a look on it?

If there is anything not understandable in this mail, I'm sorry.
Just ask, i'll try to explain.

Jozef Hovan
hovan@pobox.sk




---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org