k6-reporter icon indicating copy to clipboard operation
k6-reporter copied to clipboard

Checks & Groups : checks in subgroups are not aggregated

Open cbo44 opened this issue 4 years ago • 2 comments

Checks from subgroups should be aggregated at group level.

  • the "Checks stats" shows 4 checks
    image

  • But only 2 checks are reported on the "Checks and Groups" tab

image

  • code to reproduce :
import http from 'k6/http';
import { check, group } from 'k6';
import { htmlReport } from "https://raw.githubusercontent.com/benc-uk/k6-reporter/2.3.1/dist/bundle.js";
import {  textSummary } from 'https://jslib.k6.io/k6-summary/0.0.1/index.js';

export const options = {
  stages: [
    { target: 1, duration: '2s', },
  ]
}
  

export default function go() {
  group('Group 1', function () {
    const response = http.get('https://test.k6.io');
    check(response, {
      'Group 1: is status 200': (r) => r.status === 200,
    });
    group('Group 1.1', function () {
     
      check(response, {
        'Group 1.1: is status 200': (r) => r.status === 200,
      });
    })
  });
}

export function handleSummary(data) {
  console.info('Preparing the end-of-test summary...');
  return {
    "summary.html": htmlReport(data),
    'stdout': textSummary(data, { indent: ' ', enableColors: true }), // Show the text summary to stdout...
  };

}
  • run output :
$ k6 run sub-groups.js

          /\      |‾‾| /‾‾/   /‾‾/
     /\  /  \     |  |/  /   /  /
    /  \/    \    |     (   /   ‾‾\
   /          \   |  |\  \ |  (‾)  |
  / __________ \  |__| \__\ \_____/ .io

  execution: local
     script: sub-groups.js
     output: -

  scenarios: (100.00%) 1 scenario, 1 max VUs, 32s max duration (incl. graceful stop):
           * default: Up to 1 looping VUs for 2s over 1 stages (gracefulRampDown: 30s, gracefulStop: 30s)


running (03.0s), 0/1 VUs, 2 complete and 0 interrupted iterations
default ✓ [======================================] 0/1 VUs  2s
INFO[0003] Preparing the end-of-test summary...          source=console
INFO[0003] [k6-reporter v2.3.0] Generating HTML summary report  source=console
     █ Group 1

       ✓ Group 1: is status 200

       █ Group 1.1

         ✓ Group 1.1: is status 200

     checks.........................: 100.00% ✓ 4       ✗ 0
     data_received..................: 28 kB   9.4 kB/s
     data_sent......................: 616 B   207 B/s
     group_duration.................: avg=744.84ms min=0s    med=593.27ms max=1.79s    p(90)=1.61s    p(95)=1.7s
     http_req_blocked...............: avg=230.07ms min=0s    med=230.07ms max=460.14ms p(90)=414.12ms p(95)=437.13ms
     http_req_connecting............: avg=65.45ms  min=0s    med=65.45ms  max=130.9ms  p(90)=117.81ms p(95)=124.36ms
     http_req_duration..............: avg=1.25s    min=1.18s med=1.25s    max=1.33s    p(90)=1.31s    p(95)=1.32s
       { expected_response:true }...: avg=1.25s    min=1.18s med=1.25s    max=1.33s    p(90)=1.31s    p(95)=1.32s
     http_req_failed................: 0.00%   ✓ 0       ✗ 2
     http_req_receiving.............: avg=9.2ms    min=0s    med=9.2ms    max=18.4ms   p(90)=16.56ms  p(95)=17.48ms
     http_req_sending...............: avg=358.85µs min=0s    med=358.85µs max=717.7µs  p(90)=645.92µs p(95)=681.81µs
     http_req_tls_handshaking.......: avg=134.34ms min=0s    med=134.34ms max=268.69ms p(90)=241.82ms p(95)=255.25ms
     http_req_waiting...............: avg=1.24s    min=1.16s med=1.24s    max=1.33s    p(90)=1.31s    p(95)=1.32s
     http_reqs......................: 2       0.67081/s
     iteration_duration.............: avg=1.48s    min=1.18s med=1.48s    max=1.79s    p(90)=1.73s    p(95)=1.76s
     iterations.....................: 2       0.67081/s
     vus............................: 1       min=1     max=1
     vus_max........................: 1       min=1     max=1
  • version
$ k6 version
k6 v0.36.0 (2022-01-24T09:50:03+0000/ff3f8df, go1.17.6, windows/amd64)

cbo44 avatar Feb 12 '22 09:02 cbo44

Hello! I found another problem that is probably related to this problem. Here is the script code:

import http from 'k6/http';
import {group,check} from 'k6';
import {textSummary} from 'https://jslib.k6.io/k6-summary/0.0.1/index.js';
import {htmlReport} from 'https://raw.githubusercontent.com/benc-uk/k6-reporter/main/dist/bundle.js';
export const options={
	stages:[
		{target:1,duration:'0.1s'}
	]
};
export default function Test() {
	group('1. Test',function () {
		group('1.1. Test',function () { 
			let response=http.get('https://test.k6.io');
			check(response,{'Test check':(r) => r.status===200})
		})
	})
};
export function handleSummary(data) {
	return {
		"result.html":htmlReport(data),
		stdout: textSummary(data,{indent:" ",enableColors:true}),
	}
};

As a result on the "Checks & Groups" tab, there are no checks in the html report, even from parent groups: image Module developers, I ask you to fix this problem, please.

BlackBulletBrony avatar May 19 '22 12:05 BlackBulletBrony

I took 20 minutes and tried around. Here is an example of how to solve it: https://github.com/fentas/k6-reporter/commit/c10fc88c3222177aa09286136e32cc4f4946b533

I also added PR #41 for bootstrap theme. It is switchable with the option template: 'bootstrap'

dunno if this repo is still maintained.

fentas avatar Sep 21 '22 18:09 fentas