Saturday, August 19, 2017

JMeter—How to Reorder and Regroup JMeter Elements

The JMeter test tree contains elements that are both hierarchical and ordered. Some elements in the test trees are strictly hierarchical (Listeners, Config Elements, Post-Processors, Pre-Processors, Assertions, Timers), and some are primarily ordered (controllers, samplers).[1,7]

When you add a new JMeter element to a parent element (i.e,. Test Plan, Thread Group, etc.), it adds the new element to the end of child list.  So, sometimes you need to reorder element on the list or regroup elements under different parent elements.  For this purpose, the following JMeter's GUI supports come in handy:
  • Drag and drop
  • Cut, copy, and paste
 In this article, we will demonstrate these editing capabilities of Apache JMeter.

Cut, Copy and Paste (Case #1)


In the following Test Plan, we have three different Thread Groups under Test Plan.  At beginning, all child elements were listed under jp@gc - Stepping Thread Group.


To move these child elements into Thread Group, I can click on CSV Data Set Config, press Shift Key, select all child elements using Down Arrow, and Ctrl-X to cut them.


To paste them into Thread Group, I click on Thread Group, and Ctrl-V to paste them.


In this scenario, it will be easy for you to experiment with three different Thread Group plugins and learn their different capabilities.

Cut, Copy, and Paste (Case #2)


Sometimes you want to copy JMeter elements from one .jmx to another .jmx.  In this case, you can launch two JMeter GUI's following the instructions here .  For example, you can click on jmeter.bat twice to start two different JMeter sessions in Windows.


After you open two Test Plans in two different GUI's, you can then copy-and-paste element from one JMeter to another similar to the previous example.



Drag and Drop


For elements stored in the test tree, you can also drag-and-drop them from one position to another or change their levels in the tree hierarchy.  Note that the level of elements in the test tree determines the scope of its effect.  Read [1,6,7] for more information.

To drag a child element from one position to another position, for example,  I can click on HTTP Cache Manager,


drag it to a new position (i.e., before HTTP Cookie Manager), and drop it.


Note that the ordering of Cookie and Cache Managers in this example doesn't matter.  Read [6] and [7] for the details of execution order and scoping rules in JMeter.

References

2 comments:

Liana said...

Great Job.....It was an excellent article on JMeter—How to Reorder and Regroup JMeter Elements to hear from you which is very useful for me i am looking for this one. thank you so much for gathering all this information in one post, it’s very clever and will be extremely helpful for all people. https://goo.gl/qeGySf

lucielina said...
This comment has been removed by the author.