user320587
user320587

Reputation: 1367

How to compute total time taken to complete a thread group in JMeter?

I am looking to see if it's possible to easily compute the total time taken to complete a Thread Group. In my case, I have a thread with 100 concurrent users with 1 HTTP request. I would like to know how long did it take to complete requests from all 100 users. I tried using Transaction controller with Aggregation Report but it doesn't seem to capture the value across all concurrent users.

Thanks, J

Upvotes: 0

Views: 2442

Answers (1)

Dmitri T
Dmitri T

Reputation: 168072

  1. Add tearDown Thread Group to your Test Plan. It is executed after all thread groups so it is a good place to measure test duration.
  2. Add JSR223 Sampler as a child of the tearDown Thread Group
  3. Put the following Groovy code into "Script" area:

    def testStart = new Date(vars.get('TESTSTART.MS') as long)
    def testEnd = new Date()
    
    use(groovy.time.TimeCategory) {
        def duration = testEnd - testStart
        log.info("Test duration: ${duration.seconds}")
    }
    
  4. Once test finishes you will see its duration in seconds in jmeter.log file.

    Groovy JMeter Test Duration

    You can also use ${duration.hours}, ${duration.days}, etc.

Upvotes: 0

Related Questions