A Buildkite plugin that sets up your pipeline to run tests with Buildkite Test Engine. The plugin downloads the Test Engine Client (bktec), requests an OIDC token, ensures your test suite exists, and exports the environment variables that bktec expects.
The plugin removes the need to manually install bktec, set up authentication, or create your test suite before running tests. The plugin works with every test runner that bktec supports, including RSpec, Jest, pytest, and Go test.
steps:
- label: "RSpec"
command: bktec run
plugins:
- tests#v1.0.0:
test-runner: rspec
result-path: tmp/rspec-result.json
parallelism: 2Each step must invoke bktec run (or bktec plan) in its command — the plugin sets up the environment but does not run the test command for you. The plugin downloads bktec by default; set install-client: false if bktec is already installed on the agent.
If the suite-slug attribute is not set, the plugin uses the pipeline slug as the test suite slug. If the test suite does not exist yet, the plugin creates it from the pipeline on the first run.
steps:
- label: "Jest"
command: bktec run
plugins:
- tests#v1.0.0:
test-runner: jest
result-path: jest-results.json
parallelism: 4steps:
- label: "pytest"
command: bktec run
plugins:
- tests#v1.0.0:
test-runner: pytest
parallelism: 4steps:
- label: "Go test"
command: bktec run
plugins:
- tests#v1.0.0:
test-runner: gotest
result-path: gotest-results.xml
parallelism: 4To let bktec choose the number of partitions for a target run time, run bktec plan in a planning step with the --pipeline-upload flag, pointing at a pipeline template you supply. bktec plan uploads a follow-up step that runs the test plan. --pipeline-upload is passed directly to bktec in command: because it is not exposed as a plugin option (see Unsupported bktec flags).
steps:
- label: "Plan RSpec"
key: rspec-plan
command: bktec plan --pipeline-upload .buildkite/rspec-template.yml
plugins:
- tests#v1.0.0:
test-runner: rspec
result-path: tmp/rspec-result.json
max-parallelism: 10
target-time: 4m30sThe pipeline template at .buildkite/rspec-template.yml contains the run step:
steps:
- label: "RSpec"
key: rspec-run
depends_on: rspec-plan
command: bktec run --plan-identifier ${BUILDKITE_TEST_ENGINE_PLAN_IDENTIFIER}
parallelism: ${BUILDKITE_TEST_ENGINE_PARALLELISM}
plugins:
- tests#v1.0.0:
test-runner: rspec
result-path: tmp/rspec-result.jsonWhen the test command runs inside a Docker container, the plugin downloads bktec on the host (the default) and sets BUILDKITE_TEST_ENGINE_CLIENT_PATH that you can mount into the container. Set propagate-environment: true on the Docker plugin so the container picks up the BUILDKITE_TEST_ENGINE_* variables that are required to run bktec. Set client-os and client-arch when the host operating system or architecture differs from the container.
steps:
- label: "Jest"
command: bktec run
plugins:
- tests#v1.0.0:
test-runner: jest
client-os: linux
result-path: jest-results.json
- docker#v5.13.0:
image: node:24-slim
expand-volume-vars: true
volumes:
- "$$BUILDKITE_TEST_ENGINE_CLIENT_PATH:/usr/local/bin/bktec"
propagate-environment: trueThese options map directly to bktec flags or environment variables. For the full reference, see the Test Engine Client repository.
Any runner supported by bktec, for example rspec, jest, pytest, or gotest.
Command to run tests.
Path to the test runner's output file. Required for all runners except cypress, pytest, pytest-pants, and custom.
Test suite slug. Defaults to the pipeline slug.
Glob pattern for test files.
Exclude test files matching this pattern.
Filter tests by tag. Currently only supported by pytest.
Path to a file that lists test files to run, one per line.
Number of times to retry failing tests.
Command to run when retrying failed tests. Defaults to test-cmd.
Disable retry for muted tests.
Enable example-level splitting. Not supported by every runner.
Prefix to prepend to test file paths when requesting a test plan.
Maximum parallelism for dynamic test plans. Used with bktec plan.
Desired target time for the test suite, for example 4m30s. Must be used with max-parallelism.
Test plan identifier created by bktec plan. Set automatically in dynamic mode; can be set manually for static mode.
Exit with an error if no tests are assigned to this node.
Upload test results to Test Engine. Default: true. Set to false if you use the test collectors for richer data collection, or if you want to handle the upload yourself.
Requires bktec 2.7.0 or later.
Enable verbose output.
These options control plugin behavior and are not passed to bktec.
Download the bktec binary, add it to the PATH, and set BUILDKITE_TEST_ENGINE_CLIENT_PATH. Default: true. Set to false if bktec is already installed on the agent.
Target OS for the downloaded binary, for example linux or darwin. Defaults to the host OS. Useful when the host and a Docker container run different operating systems.
Target architecture for the downloaded binary, for example amd64 or arm64. Defaults to the host architecture.
bktec version to download, for example 2.4.0. Defaults to the latest release.
Lifetime in seconds for the OIDC token. Default: 300.
A small number of bktec flags cannot be set through environment variables, so the plugin intentionally does not expose them as options. To use any of these, pass them directly to bktec in your step's command:.
| Flag | Command | Notes |
|---|---|---|
--selection-param |
run, plan |
Preview selection |
--metadata |
run, plan |
Preview selection |
--json |
plan |
Print the plan as JSON to stdout |
--pipeline-upload |
plan |
Upload a follow-up pipeline step that runs the plan |
--output |
backfill-commit-metadata |
Write tarball locally |
--upload |
backfill-commit-metadata |
Upload an existing tarball |
--version |
Global | No environment variable needed |
Bug reports and pull requests are welcome on GitHub at https://github.com/buildkite-plugins/tests-buildkite-plugin.
MIT (see LICENSE.txt).