Skip to content

Releases: grafana/xk6-python

v0.1.0

17 Sep 17:15
Compare
Choose a tag to compare

xk6-python v0.1.0 is here 🎉!

This is the initial release.

Status

xk6-python is currently in Proof of Concept status, but can already be used to run real k6 tests written in Python.

Check the documentation for available modules.

Usage

  1. Download the archive for your operating system and extract the k6 executable from it: Windows, Mac, Linux

  2. Create a k6 test script in python (script.py). The following example can be a good starting point:

    load("check", "check")
    load("requests", "get")
    load("time", "sleep")
    
    options = {
        "vus": 5,
        "duration": "5s",
        "thresholds": {
            "checks": ["rate>=0.99"],
        },
    }
    
    def default(_):
        resp = get("https://httpbin.test.k6.io/get")
    
        check(resp, {
            "is status 200": lambda r: r.status_code == 200,
        })
    
        sleep(0.5)
  3. Run the script with the k6 executable extracted from the release:

    ./k6 run script.py
  4. Read the documentation about the available APIs.


Happy   hacking!