Skip to content

automazeio/proof-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

proof-go

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.

Install

go get github.com/automazeio/proof-go

Usage

package 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

    reportPath, _ := p.Report(proof.ReportOptions{})
    fmt.Println(reportPath)
}

go test integration

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)
}

Binary resolution

  1. proof on PATH
  2. ~/.proof/bin/proof-<version> (cached from previous download)
  3. Auto-download from GitHub Releases (~100MB, one time)

Install the binary manually

curl -fsSL https://automaze.io/install/proof | sh

About

Go SDK for proof — capture visual evidence of test execution

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages