Rust collector
To use Test Engine with your Rust projects use the
test-collector-rust package with cargo test.
You can also upload test results by importing JSON or JUnit XML.
Before you start, make sure Rust runs with access to CI environment variables.
Create a test suite and copy the API token that it gives you.
-
Install the
buildkite-test-collectorcrate:$ cargo install buildkite-test-collector # or $ cargo install --git https://github.com/buildkite/test-collector-rust buildkite-test-collector -
Configure your environment:
Set the
BUILDKITE_ANALYTICS_TOKENenvironment variable to contain the token provided by the analytics project settings.We try and detect several common CI environments based in the environment variables which are present. If this detection fails then the application will crash with an error. To force the use of a "generic CI environment" set the
CIenvironment variable to any non-empty value. -
Change your test output to JSON format:
In your CI environment you will need to change your output format to
JSONand add--report-timeto include execution times in the output. Unfortunately, these are currently unstable options for Rust, so some extra command line options are needed. Once you have the JSON output you can pipe it through thebuildkite-test-collectorbinary - the input JSON is echoed back to STDOUT so that you can still operate upon it if needed.$ cargo test -- -Z unstable-options --format json --report-time | buildkite-test-collector Confirm correct operation. Verify that the run is visible in the Buildkite Test Engine dashboard.