Search⌘ K

Running Unit Tests for Multi-git

Explore how to run Ginkgo unit tests for Multi-git using both go test and the Ginkgo CLI. Understand how to generate and visualize test coverage profiles, and discover how to focus tests for efficient debugging and development.

Running Ginkgo tests

As you recall, Ginkgo tests are actually standard Go tests. We can run them either with go test or using the Ginkgo CLI. Let’s try both.

Running Ginkgo tests with “go test”

This is exactly the same as running non-Ginkgo tests. Just type go test to run all the Ginkgo tests.

The go test command has several other command-line arguments that can be useful. Check out the full list here: https://golang.org/cmd/go/#hdr-Testing_flags

However, when running Ginkgo tests, I recommend using the Ginkgo command itself.

Running Ginkgo tests with Ginkgo

First, make sure that ginkgo is installed. If it’s not, follow the instructions here: https://onsi.github.io/ginkgo/#getting-ginkgo

As you can see, the context and the test name are displayed for each test.

Checking test coverage

We can check the test coverage with Ginkgo as well using the ginkgo -cover command.

Okay. We have 70.6% ...