Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear the results in Aggregate Report's table in JMeter automatically when executing the same test plan again?

So after executing a test run, I have the Aggregate Report's table filled with the data of the test plan that just finished running. Now, when I execute the test plan again, the results are getting added to this data in the Aggregate Report's table, but I would like the table data to be cleaned up before starting to display the results for the current run. Any way to do this?

like image 457
Srikanth Avatar asked Feb 04 '11 14:02

Srikanth


People also ask

How can you aggregate the results of multiple samples into 1 aggregate label in JMeter?

If you do not plan to re-run your test in future and would just like to convert 4 results files into a single "uber" results file you can use Merge Results tool which main use case is to compare results of different test runs, however you can use it to combine multiple results files into one, just use the same Prefix ...

What is the difference between aggregate report and summary report in JMeter?

In JMeter, we have different listeners to view the result of Test Plan, in which aggregate report is one of the listeners that are provided by the JMeter. The aggregate report is the same as the summary report except the aggregate listener provides some additional parameters such as Median.

What is the correct order of execution of JMeter test plan?

The order of execution would be: Pre-Processor 1. Timer 1. Timer 2.


3 Answers

Jmeter does not have a flag to do this automatically.

Generally, you have to clear the results with CTRL+E (in windows) or from the file menu, under RUN > CLEAR or RUN > CLEAR ALL

You might be able to write a beanshell script to clear the results everytime you execute the script.

http://www.javadocexamples.com/java_examples/org/apache/jmeter/samplers/SampleListener/

like image 51
BlackGaff Avatar answered Sep 26 '22 01:09

BlackGaff


Here is a Beanshell script that will clear the results everytime you execute it:

import org.apache.jmeter.gui.GuiPackage;
import org.apache.jmeter.gui.JMeterGUIComponent;
import org.apache.jmeter.gui.tree.JMeterTreeNode;
import org.apache.jmeter.samplers.Clearable;

log.info("Clearing All ...");

guiPackage = GuiPackage.getInstance();

guiPackage.getMainFrame().clearData();
for (JMeterTreeNode node : guiPackage.getTreeModel().getNodesOfType(Clearable.class)) {
    JMeterGUIComponent guiComp = guiPackage.getGui(node.getTestElement());
    if (guiComp instanceof Clearable){
        Clearable item = (Clearable) guiComp;
        try {
            item.clearData();
        } catch (Exception ex) {
            log.error("Can't clear: "+node+" "+guiComp, ex);
        }
    }
}

To use this Beanshell script in your JMeter Script :

1) Select the root node of your JMeter Script, and, using the mouse menu, add a setup node :

   Add / Threads (Users) / setup Thread Group

2) Select the newly created node, and using the mouse menu, add a script node :

   Add / Samplers / Beanshell Sampler

3) Finally, copy and paste the above script into the Script window.

like image 29
Ingo Jobling Avatar answered Sep 25 '22 01:09

Ingo Jobling


Note: Manual procedure to achieve this via GUI functions is given below.

The Clear option is available under the Run menu.

Function Windows Keyboard Shortcut macOS Keyboard Shortcut
Clear CTRL+SHIFT+E +SHIFT+E
Clear All CTRL+E +E
like image 37
Saikat Avatar answered Sep 24 '22 01:09

Saikat