Configuring Go with Test Engine
To use Test Engine with your Go language projects use gotestsum to generate JUnit XML files, then upload the JUnit XML files to Test Engine.
-
Install gotestsum:
go install gotest.tools/gotestsum@latest
-
Use gotestsum to run your tests and output JUnit XML, by replacing
go test
withgotestsum
, for example:gotestsum --junitfile junit.xml ./...
-
Upload the JUnit.xml to Buildkite:
curl \ -X POST \ --fail-with-body \ -H "Authorization: Token token=\"$BUILDKITE_ANALYTICS_TOKEN\"" \ -F "data=@junit.xml" \ -F "format=junit" \ -F "run_env[CI]=buildkite" \ -F "run_env[key]=$BUILDKITE_BUILD_ID" \ -F "run_env[number]=$BUILDKITE_BUILD_NUMBER" \ -F "run_env[job_id]=$BUILDKITE_JOB_ID" \ -F "run_env[branch]=$BUILDKITE_BRANCH" \ -F "run_env[commit_sha]=$BUILDKITE_COMMIT" \ -F "run_env[message]=$BUILDKITE_MESSAGE" \ -F "run_env[url]=$BUILDKITE_BUILD_URL" \ https://analytics-api.buildkite.com/v1/uploads
See gotestsum for full documentation of its features and command-line flags.