0

Scenario: 5 slaves, 1 master JMeter environment. The Jmeter project basically picks up urls from a list and the JSR223 sampler has web-driver code to call the url and measure the total load time of each url.

Problem statement: While performing a single user test, I can easily output the value of my function in the JSR223 sampler to a csv file and get results. However, while running the same test in distributed environment, each node would write to its own csv file and would be a pain to aggregate results from there. Any help?

Also, I cannot depend on the aggregate calc in Jmeter master, as it would be the total time for the thread, whereas my function calculates the exact rendering time and which is what I am interested in and writing to csv.

some code <> while ( javaScriptDriver.executeScript("return window.xx_NumRequests();",new Object[0]) > 0 ) {

    Thread.sleep(100);
}

var endTime = (new Date()).getTime();
var millisecondsLoading = endTime - startTime;
System.out.println( millisecondsLoading);
f = new FileOutputStream("c:\\Jmeter\\result.csv", true);
p = new PrintStream(f);
p.println(report);
p.println(millisecondsLoading);
p.close();
f.close();
driver.quit();

Any ideas, on how can i achieve this aggregation result while running multiple slaves in my environment?

Thanks.

1 Answers1

0

I would recommend the following:

  1. In WebDriver Sampler define a JMeter Variable, i.e. millisecondsLoading as:

    var vars = org.apache.jmeter.threads.JMeterContextService.getContext().getVariables()
    vars.put('millisecondsLoading',millisecondsLoading)
    
  2. On all your slave machines add the following line to user.properties file

    sample_variables=millisecondsLoading
    

On next slave JMeter engine start it will add new column to .jtl file which will hold ${millisecondsLoading} variable value, on test end master will collect result files from slaves and you'll get aggregate output you're looking for.

References:

Dmitri T
  • 119,313
  • 3
  • 56
  • 104