Skip to content

How to integrate Captain with go test

Notifications You must be signed in to change notification settings

captain-examples/go-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Captain working with go test

  1. 🧪 Ensure go test produces JSON output

go test ./... -json will produce Captain-compatible JSON output, but it will squash any other output. We recommend installing gotestsum and using it to produce jsonfile output.

go install gotest.tools/gotestsum@latest
gotestsum --jsonfile results.json
  1. 🔐 Create an Access Token

Create an Access Token for your organization within Captain (more documentation here).

Add the new token as an action secret to your repository. Conventionally, we call this secret RWX_ACCESS_TOKEN.

  1. 💌 Install the Captain CLI, and then call it when running tests

See the full documentation on test suite integration.

  - run: |
      captain run --suite-id captain-examples-go-test --test-results results.json -- \
        gotestsum --jsonfile results.json
    env:
      RWX_ACCESS_TOKEN: ${{ secrets.RWX_ACCESS_TOKEN }}
  1. 🎉 See your test results in Captain!

Take a look at the final workflow!

About

How to integrate Captain with go test

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages