Simple unit test in GoLang
Create a simple function to add two arguments, and then create a simple unit test to test the function
Step 1 — Creating a sample golang package on main.go
Step 2 — Creating a unit test on main_test.go
Step 3 — Run the test
- ubuntu 16 or higher
- Golang 1.11 or higher
- import FMT and Testing packages
- go mod init
- go run main.go
- go test
- go test -bench=.
vahid mashmooli vahidmashmooli@gmail.com
- 0.001