Any possibility to find the Group response time?

Hello All,

I am able to calculate an individual request response time as shown below.

  const res = http.get(`http://localhost:9000/page/1`);
  page1.add(res.timings.duration);

Along similar lines is there any possibility to find the response time of all the requests in a group as shown below?

  group('group_page23', function () {
    http.get(`http://localhost:9000/page/2`);
    http.get(`http://localhost:9000/page/3`);
  });

Regards,
Bharath.

Hello,
If you want group statistics to appear in the end-of-test summary, you will need to add a threshold for it until we implement #1321.

For example:

import { group } from 'k6';
import http from 'k6/http';

export const options = {
  thresholds: {
    'group_duration{group:::My Group}': ['max>=0'], // will always pass
    'group_duration{group:::My 2nd Group}':['p(95)<=200'], // an actual threshold
  }
}

export default function () {
  group("My Group", function() {
    http.get('https://httpbin.test.k6.io/anything');

    http.get('https://httpbin.test.k6.io/');
  });

  group("My 2nd Group", function () {
    http.get('https://httpbin.test.k6.io/anything');

    http.get('https://httpbin.test.k6.io/');
  });
}

Will produce output that looks like this:

     data_received..................: 265 kB 392 kB/s
     data_sent......................: 7.9 kB 12 kB/s
     group_duration.................: avg=328.94ms min=193.83ms med=334.15ms max=466.51ms p(90)=458.53ms p(95)=466.51ms
     ✗ { group:::My 2nd Group }.....: avg=210.57ms min=193.83ms med=206.72ms max=235.17ms p(90)=224.08ms p(95)=229.62ms
     ✓ { group:::My Group }.........: avg=447.3ms  min=433.12ms med=442.12ms max=466.51ms p(90)=466.51ms p(95)=466.51ms
     http_req_blocked...............: avg=66.2ms   min=0s       med=0s       max=265.88ms p(90)=264.83ms p(95)=264.85ms
     http_req_connecting............: avg=19.34ms  min=0s       med=0s       max=80.62ms  p(90)=76.23ms  p(95)=80.62ms
     http_req_duration..............: avg=98.15ms  min=78.86ms  med=95.04ms  max=127.8ms  p(90)=118.88ms p(95)=122.9ms
       { expected_response:true }...: avg=98.15ms  min=78.86ms  med=95.04ms  max=127.8ms  p(90)=118.88ms p(95)=122.9ms
     http_req_failed................: 0.00%  ✓ 0         ✗ 40
     http_req_receiving.............: avg=2.02ms   min=0s       med=0s       max=18.45ms  p(90)=7.13ms   p(95)=9.19ms
     http_req_sending...............: avg=3.88µs   min=0s       med=0s       max=84.2µs   p(90)=0s       p(95)=12.46µs
     http_req_tls_handshaking.......: avg=24.96ms  min=0s       med=0s       max=103.2ms  p(90)=100.92ms p(95)=101.4ms
     http_req_waiting...............: avg=96.12ms  min=70.97ms  med=94.22ms  max=127.8ms  p(90)=118.8ms  p(95)=122.9ms
     http_reqs......................: 40     59.231986/s
     iteration_duration.............: avg=657.88ms min=638.92ms med=658.13ms max=673.3ms  p(90)=668.8ms  p(95)=671.05ms
     iterations.....................: 10     14.807997/