Running Go Tests

In this lesson, you will learn how to run tests using go test.

Running tests with go test

Now that we have some tests, let’s run them.

Running functional tests

Running Go tests is very easy. Just type go test. If you want a little more verbose output that lists the tests being run, type go test -v. If you run the test below, you’ll see this output:

=== RUN   TestCalcAreaSuccess
--- PASS: TestCalcAreaSuccess (0.00s)
=== RUN   TestCalcAreaFail
--- PASS: TestCalcAreaFail (0.00s)
=== RUN   TestCalcAreaViaTable
--- PASS: TestCalcAreaViaTable (0.00s)
ok  	_/usercode	0.003s

Get hands-on with 1200+ tech skills courses.