podhmo / go-webtest

Sometimes, easy is better than simple
MIT License
1 stars 0 forks source link

snapshot testing #2

Closed podhmo closed 5 years ago

podhmo commented 5 years ago

todo: document

podhmo commented 5 years ago
# first-time, save golden data, at `testdata/<func name>.golden`
$ go test 

# after that, compare with golden data (not saved)
$ go test

# if you want to update golden data
$ SNAPSHOT=<func name> go test

# or update all.
$ SNAPSHOT=1 go test
podhmo commented 5 years ago

what is <func name> ?

this

$ go test -v
=== RUN   TestSimple   # <- this
--- PASS: TestSimple (0.00s)
    snapshot.go:52: load testdata: "testdata/TestSimple.golden"