https://github.com/juntaki/fix
Golden Files Testing library for Go
https://github.com/juntaki/fix
fixture golang testing
Last synced: 6 months ago
JSON representation
Golden Files Testing library for Go
- Host: GitHub
- URL: https://github.com/juntaki/fix
- Owner: juntaki
- License: mit
- Created: 2018-07-21T00:38:30.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-05-09T14:48:25.000Z (over 3 years ago)
- Last Synced: 2025-03-27T15:21:26.314Z (6 months ago)
- Topics: fixture, golang, testing
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fix - Golden Files Testing library for Go
[](https://pkg.go.dev/github.com/juntaki/fix)
This library, like Ruby's [vcr](https://github.com/vcr/vcr), serializes the results once executed and saves them as a file. You can easily write tests to verify that the code outputs the same results as in the past, even after modifying the code.
~~~
go get github.com/juntaki/fix
~~~## How to use
Append code like below to your tests. and Run test twice.
~~~
err := fix.Fix(&output) // output is dumped to a file.
if err != nil {
t.Fatal(err)
}
~~~First test will fail, because juntaki/fix writes serialized data to file.
From the second time, the test will pass, if output is the same as first output.