Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matryer/is
Professional lightweight testing mini-framework for Go.
https://github.com/matryer/is
golang testing
Last synced: 22 days ago
JSON representation
Professional lightweight testing mini-framework for Go.
- Host: GitHub
- URL: https://github.com/matryer/is
- Owner: matryer
- License: mit
- Created: 2016-12-06T13:24:01.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-02-08T21:33:15.000Z (9 months ago)
- Last Synced: 2024-10-10T23:05:14.228Z (26 days ago)
- Topics: golang, testing
- Language: Go
- Homepage:
- Size: 386 KB
- Stars: 1,774
- Watchers: 24
- Forks: 58
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-go - is - Professional lightweight testing mini-framework for Go. (Testing / Testing Frameworks)
- awesome-repositories - matryer/is - Professional lightweight testing mini-framework for Go. (Go)
- go-awesome - is - Mini testing framework (Open source library / Test)
- awesome-go - is - Professional lightweight testing mini-framework for Go. Stars:`1.8K`. (Testing / Testing Frameworks)
- awesome-go-extra - is - framework for Go.|1473|50|9|2016-12-06T13:24:01Z|2022-05-16T09:57:40Z| (Testing / Testing Frameworks)
README
# is [![GoDoc](https://godoc.org/github.com/matryer/is?status.png)](http://godoc.org/github.com/matryer/is) [![Go Report Card](https://goreportcard.com/badge/github.com/matryer/is)](https://goreportcard.com/report/github.com/matryer/is)
Professional lightweight testing mini-framework for Go.* Easy to write and read
* [Beautifully simple API](https://pkg.go.dev/github.com/matryer/is) with everything you need: `is.Equal`, `is.True`, `is.NoErr`, and `is.Fail`
* Use comments to add descriptions (which show up when tests fail)Failures are very easy to read:
![Examples of failures](https://github.com/matryer/is/raw/master/misc/delicious-failures.png)
### Usage
The following code shows a range of useful ways you can use
the helper methods:```go
func Test(t *testing.T) {
is := is.New(t)
signedin, err := isSignedIn(ctx)
is.NoErr(err) // isSignedIn error
is.Equal(signedin, true) // must be signed in
body := readBody(r)
is.True(strings.Contains(body, "Hi there"))
}
```## Color
To turn off the colors, run `go test` with the `-nocolor` flag,
or with the env var [`NO_COLOR` (with any value)](https://no-color.org).```
go test -nocolor
``````
NO_COLOR=1 go test
```