Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.
/ xk6-execution Public archive

A k6 JavaScript extension that returns information about a test run.

License

Notifications You must be signed in to change notification settings

grafana/xk6-execution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

xk6-execution

A k6 JavaScript extension using the xk6 system that returns information about a test run including VU, scenario and test statistics.

❗ This project is deprecated.
The module has moved to k6 core as k6/execution.

Build

To build a k6 binary with this extension, first ensure you have installed the prerequisites:

Then:

  1. Install xk6:
go install go.k6.io/xk6/cmd/xk6@latest
  1. Build the binary:
xk6 build master \
  --with github.com/grafana/xk6-execution

Example

import { sleep } from 'k6';
import exec from 'k6/x/execution';

export let options = {
  scenarios: {
    shared: {
      executor: 'shared-iterations',
      vus: 50,
      iterations: 500,
    }
  }
}

function logObj(msg, o) {
  console.log(msg, JSON.stringify(o, Object.keys(o).sort()));
}

export default function () {
  sleep(1);
  logObj('VU stats:', exec.vu);
  logObj('Scenario stats:', exec.scenario);
  logObj('Test stats:', exec.instance);
}

Sample output:

INFO[0009] VU stats: {"idInInstance":36,"idInTest":36,"iterationInInstance":8,"iterationInScenario":8}  source=console
INFO[0009] Scenario stats: {"executor":"shared-iterations","iterationInInstance":429,"iterationInTest":429,"name":"shared","progress":0.858,"startTime":1624262301.1202478}  source=console
INFO[0009] Test stats: {"currentTestRunDuration":9035.161124,"iterationsCompleted":429,"iterationsInterrupted":0,"vusActive":50,"vusInitialized":50}  source=console

TODO:

  • Document all fields

About

A k6 JavaScript extension that returns information about a test run.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •