More golang testing tips
This commit is contained in:
parent
6ea7b84b36
commit
0fdf28c615
1 changed files with 22 additions and 0 deletions
|
@ -77,3 +77,25 @@ t.Fatalf()
|
||||||
## I don't want my tests to be messy (kudos @athoune)
|
## I don't want my tests to be messy (kudos @athoune)
|
||||||
|
|
||||||
[Assert](https://godoc.org/github.com/stretchr/testify/assert)
|
[Assert](https://godoc.org/github.com/stretchr/testify/assert)
|
||||||
|
|
||||||
|
## Shit, i want to disable my oauth test on my CI
|
||||||
|
|
||||||
|
```golang
|
||||||
|
if os.Getenv("DRONE") == "true" {
|
||||||
|
t.Skip("Skipping test in CI environment")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Short mode
|
||||||
|
|
||||||
|
This test is too long ? Skip it !
|
||||||
|
|
||||||
|
```golang
|
||||||
|
if testing.Short() {
|
||||||
|
t.Skip("Skipping test in short mode")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
go test github.com/go/pkg/package --short
|
||||||
|
```
|
Loading…
Reference in a new issue