2018-06-08 12:09:51 -04:00
|
|
|
# gotest.tools
|
|
|
|
|
|
|
|
A collection of packages to augment `testing` and support common patterns.
|
|
|
|
|
2020-02-07 08:39:24 -05:00
|
|
|
[![GoDoc](https://godoc.org/gotest.tools?status.svg)](http://gotest.tools)
|
2019-04-05 11:02:23 -04:00
|
|
|
[![CircleCI](https://circleci.com/gh/gotestyourself/gotest.tools/tree/master.svg?style=shield)](https://circleci.com/gh/gotestyourself/gotest.tools/tree/master)
|
2018-06-08 12:09:51 -04:00
|
|
|
[![Go Reportcard](https://goreportcard.com/badge/gotest.tools)](https://goreportcard.com/report/gotest.tools)
|
|
|
|
|
2020-02-07 08:39:24 -05:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
With Go modules enabled (go1.11+)
|
|
|
|
|
|
|
|
```
|
|
|
|
$ go get gotest.tools/v3
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
import "gotest.tools/v3/assert"
|
|
|
|
```
|
|
|
|
|
|
|
|
To use `gotest.tools` with an older version of Go that does not understand Go
|
|
|
|
module paths pin to version `v2.3.0`.
|
|
|
|
|
2018-06-08 12:09:51 -04:00
|
|
|
|
|
|
|
## Packages
|
|
|
|
|
2020-02-07 08:39:24 -05:00
|
|
|
* [assert](http://gotest.tools/assert) -
|
2018-06-08 12:09:51 -04:00
|
|
|
compare values and fail the test when a comparison fails
|
2020-02-07 08:39:24 -05:00
|
|
|
* [env](http://gotest.tools/env) -
|
2018-06-08 12:09:51 -04:00
|
|
|
test code which uses environment variables
|
2020-02-07 08:39:24 -05:00
|
|
|
* [fs](http://gotest.tools/fs) -
|
2018-06-08 12:09:51 -04:00
|
|
|
create temporary files and compare a filesystem tree to an expected value
|
2020-02-07 08:39:24 -05:00
|
|
|
* [golden](http://gotest.tools/golden) -
|
2018-06-08 12:09:51 -04:00
|
|
|
compare large multi-line strings against values frozen in golden files
|
2020-02-07 08:39:24 -05:00
|
|
|
* [icmd](http://gotest.tools/icmd) -
|
2018-06-08 12:09:51 -04:00
|
|
|
execute binaries and test the output
|
2020-02-07 08:39:24 -05:00
|
|
|
* [poll](http://gotest.tools/poll) -
|
2018-06-08 12:09:51 -04:00
|
|
|
test asynchronous code by polling until a desired state is reached
|
2020-02-07 08:39:24 -05:00
|
|
|
* [skip](http://gotest.tools/skip) -
|
2018-06-08 12:09:51 -04:00
|
|
|
skip a test and print the source code of the condition used to skip the test
|
|
|
|
|
|
|
|
## Related
|
|
|
|
|
|
|
|
* [gotest.tools/gotestsum](https://github.com/gotestyourself/gotestsum) - go test runner with custom output
|
|
|
|
* [maxbrunsfeld/counterfeiter](https://github.com/maxbrunsfeld/counterfeiter) - generate fakes for interfaces
|
|
|
|
* [jonboulle/clockwork](https://github.com/jonboulle/clockwork) - a fake clock for testing code that uses `time`
|
2019-04-05 11:02:23 -04:00
|
|
|
|
|
|
|
## Contributing
|
|
|
|
|
|
|
|
See [CONTRIBUTING.md](CONTRIBUTING.md).
|