Run individual Go tests, sub-tests, and (static) table‑driven test cases directly from the VS Code Test Explorer.
Go Testing+ augments the official Go extension's testing UI to give you fine‑grained control over Go test execution. It statically discovers:
- Test files (
*_test.go) - Top‑level test functions (
func TestXxx(t *testing.T)) - Nested
t.Run("case", ...)sub‑tests (including those generated by simple table‑driven tests) - Nested table tests (recursive
t.Runchains)
Then it lets you run exactly the scope you select (single case, whole function, file, or all) via a dedicated run profile: Go+.
- Automatic discovery & refresh of Go test files (
**/*_test.go) via file system watchers - Run profile: Go+ (standard run) and Go+ (Debug) (debug run)
- Run single sub‑test without executing siblings (narrow
go test -run '^Full/Test/Path$'pattern) - Support for nested table tests (static detection through symbol & reference analysis)
- Partial support for dynamic sub‑test names (i.e. concatenated names): they are discovered after the first run
- Parses
go test -jsonoutput and streams relevant lines into the Test Explorer - Failure message parsing with file & line hyperlink locations
- Go toolchain installed and
goavailable on your PATH - Go modules enabled (
GO111MODULE=onimplicitly set if not present)
The extension creates the following Test Run Profile:
- Go+ – Standard run (non‑debug) for any selected scope.
- Go+ (Debug) – Debug run for any selected scope.
- Dynamic table test names built from variable concatenation and test cases with positional initialization (i.e. without field names) are only resolved after the first run.
tests := []struct {
name string
fail bool
skip bool
}{
{"test A", false, false},
{"test " + "B", false, false},
...- Indirect usages of the testing.T variable inside the main test function would not be statically discovered. This is because the extension relies on static analysis of references to the parameter of the test function. For example:
func TestXxx(t *testing.T) {
tt := t
tt.Run("case1", func(t *testing.T) { ... })
}- Benchmark (
BenchmarkXxx) and example tests are not discovered.
Contributions are welcome!
Happy testing! 🧪

