Basic Locust Example
Below is a basic workflow for executing a Locust test which is available
on GitHub. You can paste this directly into the YAML of an existing or new test, just make
sure to update the name
and namespace
for your environment if needed.
- The
spec.content
property defines the location of the GitHub project - the
spec.steps
property defines a single step that runs the test and uploads the created reports.
Basic Locust Workflow
kind: TestWorkflow
apiVersion: testworkflows.testkube.io/v1
metadata:
name: locust-workflow-smoke
namespace: testkube
labels:
docs: example
spec:
content:
git:
uri: https://github.com/kubeshop/testkube
revision: main
paths:
- test/locust/locust-project
container:
workingDir: /data/repo/test/locust/locust-project
steps:
- name: Run test
run:
image: locustio/locust:2.32.3
shell: |
mkdir /data/artifacts
locust -f locust_test.py --host https://testkube-test-page-lipsum.pages.dev/ --headless --users 6 --spawn-rate 3 --run-time 10s --html=/data/artifacts/report.html
artifacts:
paths:
- /data/artifacts/**
After execution, you can see the output from the test executions under the executions panel tabs:
- Log Output
- Artifacts
- HTML report
The log output from the Locust execution:
The uploaded report is available in the Artifacts tab:
Clicking the HTML report opens it in your browser: