Some test writing examples in Golang.Fuzz testing will only work starting with Go 1.18.
☝️ Every folder contains a different testing method using standard libraries, convey and fuzz testing.
👉 We tried to keep it as simple as possible to make the logic behind the test as clear as possible.
- make sure you are in selected folder e.g.
cd compare
- run the test by
$ go test
✅
- run
go test
orgo test -v
- run
go test -run=TestName
(for specific test)
- if you have an outdated dependencies in
go.mod
file- run
$ go mod tidy
- run
- if you have conflicts between your local Go 1.xx version and version in
go.mod
file- create new
go.mod
file by$ go mod init nameoftheproject
- create new
- to check that your code is 100% covered
Print result in console:
- run
$ go test -cover -v
😎
Open result in browser:
- run test
$ go test -coverprofile=coverage.out
- open in browser
$ go tool cover -html=coverage.out