Go SDK for proof -- capture visual evidence of test execution.
Thin wrapper around the proof CLI. If the binary isn't on PATH, it auto-downloads from GitHub Releases on first use.
go get github.com/automazeio/proof-gopackage main
import (
"fmt"
"github.com/automazeio/proof-go/proof"
)
func main() {
p, err := proof.New(proof.Config{
AppName: "my-app",
ProofDir: "./evidence",
})
if err != nil {
panic(err)
}
rec, err := p.Capture(proof.CaptureOptions{
Command: "go test ./... -v",
Mode: "terminal",
Label: "unit-tests",
})
if err != nil {
panic(err)
}
fmt.Println(rec.Path) // /abs/path/unit-tests-143012.html
fmt.Println(rec.Duration) // 4300
fmt.Println(rec.ExitCode) // 0 (exit code of the wrapped command)
reportPath, _ := p.Report(proof.ReportOptions{})
fmt.Println(reportPath)
}Capture always records the run and returns the Recording — it does not return an error just because the wrapped command failed. Inspect ExitCode to gate:
rec, _ := p.Capture(proof.CaptureOptions{Command: "go test ./...", Mode: "terminal"})
p.Report(proof.ReportOptions{})
if rec.ExitCode != 0 {
os.Exit(rec.ExitCode) // fail the run, keep the evidence
}func TestMain(m *testing.M) {
p, _ := proof.New(proof.Config{
AppName: "my-service",
ProofDir: "./evidence",
})
p.Capture(proof.CaptureOptions{
Command: "go test ./... -v -count=1",
Mode: "terminal",
Label: "all-tests",
})
code := m.Run()
p.Report(proof.ReportOptions{})
os.Exit(code)
}proofon PATH~/.proof/bin/proof-<version>(cached from previous download)- Auto-download from GitHub Releases (~100MB, one time)
curl -fsSL https://automaze.io/install/proof | sh