Janesh Kodikara
Janesh Kodikara

Reputation: 1821

How to ignore the test results during the ramp-up and ramp-down period

I would like to remove the test results during the ramp-up and ramp-down periods. This will help me to get test results during constant workloads. Also, it will remove outliers during the ramping time.

The solution shall be integrated with the JMeter script (JMX) itself. Removing the test results from the test result files (jtl,csv,xml) adds some extra work.

Synthesis Report plugin could help to a certain extent. But it needs manual intervention and has limited reporting capability. Synthesis Report is a mix between Summary Report and Aggregate Report:

Upvotes: 2

Views: 1706

Answers (2)

Janesh Kodikara
Janesh Kodikara

Reputation: 1821

I have created a Test Fragment with a JSR223 Post Processor and placed it just after the Test Plan component to ensure it is applied to all the Samplers in the Test Plan.

enter image description here

Add the following arguments into the Parameters

${__P(ignore_ramping_time_results,true)}  ${__P(testResultToIgnoreBeforeInMin,5)} ${__P(testResultToIgnoreAfterInMin,65)}
  1. arg[0] - Set true to ignore the result and false to include the result
  2. arg[1] - Set the ramp-up time in minutes. If you set 2, test results during the first two minutes will be ignored
  3. arg[2] - Set the ramp-down start time in minutes. If you set it to 10, all the results after 10 minutes will be ignored.

enter image description here

if(args[0].toBoolean()){
    int testResultToIgnoreBeforeInMin=args[1].toInteger()
    int testResultToIgnoreAfterInMin=args[2].toInteger()
    
    long testResultToIgnoreBeforeInMillis=testResultToIgnoreBeforeInMin*60*1000
    long testResultToIgnoreAfterInMillis=testResultToIgnoreAfterInMin*60*1000
    
    long startTimeInMillis=vars.get("TESTSTART.MS").toLong()
    long currentTimeInMillis = new Date().getTime()
    long currentTestDurationInMillis=currentTimeInMillis-startTimeInMillis
    
    log.info("currentTestDurationInMillis ${currentTestDurationInMillis}")
    
    
    if(currentTestDurationInMillis< testResultToIgnoreBeforeInMillis || currentTestDurationInMillis >testResultToIgnoreAfterInMillis){
        prev.setIgnore()
        log.info("Test result is ignored")
    }
}

Pre-Defined Property

TESTSTART.MS - test start time in milliseconds is used in the script to get the test start time.

Upvotes: 3

Dmitri T
Dmitri T

Reputation: 168122

Just remove the ramp-up and ramp-down phases from the .jtl results file, the options are in:

  1. Filter Results Tool which provides --start-offset and --end-offset parameters so you can "cut" the ramp-up and ramp-down phases

  2. JMeterPluginsCMD Command Line Tool which you seem to be using already as you're mentioning Synthesis Report:

    JMeterPluginsCMD --generate-csv report.csv --input-jtl /path/to/your/result.jtl --start-offset your-ramp-up-period-in-seconds --end-offset your-ramp-down-period-in-seconds --plugin-type SynthesisReport 
    

Upvotes: 2

Related Questions