Skip to main content
The execution context API provides information about the current test execution state.

Import

Properties

exec.instance

Provides information about the local k6 instance.
number
Current test run duration in milliseconds
number
Number of completed iterations
number
Number of interrupted iterations
number
Number of currently active VUs
number
Number of initialized VUs

exec.scenario

Provides information about the current scenario.
string
Scenario name
string
Executor type (e.g., “ramping-vus”, “constant-vus”)
number
Scenario start time (Unix timestamp in milliseconds)
number
Scenario progress (0 to 1)
number
Current VU’s iteration number in this instance
number
Current VU’s iteration number across all instances

exec.vu

Provides information about the current VU.
number
VU ID within the local instance (1-based)
number
VU ID globally across all instances (1-based)
number
Current iteration number for this VU in the instance
number
Current iteration number for this VU in the scenario
object
Dynamic object for getting/setting VU tags
object
Object containing tags and metadata

exec.test

Provides test-level information and control.
object
Consolidated test options (read-only)
function
Aborts the test execution immediately
function
Marks the test as failed but continues execution

Examples

VU-specific Behavior

Progress Monitoring

Conditional Abort

Dynamic Tagging

Iteration-based Logic

Execution context properties cannot be accessed in the init context. They are only available in the VU context (default function).