Run Go tests and subtests seamlessly with native VS Code integration.
Better Go Test integrates your Go test files directly into the native VS Code Testing API, providing a powerful, visual, and lightweight test runner. No more messy terminal command pasting—run whole files, individual functions, or specific subtests directly from the UI.
✨ Features
- 📂 Native Test Explorer Integration: Discovers all your
*_test.gofiles and organizes them in a neat, expandable tree view in the VS Code Test panel. - 🗂️ Table-Driven (Subtest) Parsing: Automatically parses table-driven test definitions (
t.Run) to extract individual subtest cases dynamically without compiling. - 🟢 Gutter Play/Debug Buttons: Shows executable indicators directly in the editor margin (gutter) next to the test functions and inside the struct literals for individual subtest cases.
- ⚡ Editor Title Bar Button: Quickly execute the active test file with a dedicated play icon on the editor's top-right toolbar.
- ⚙️ Background Execution: Spawns test runs as clean child processes and streams stdout/stderr directly into the native VS Code Test Output window.
- ⏹️ Execution Cancellation: Stop running tests at any time using the stop button in the VS Code Test UI.
🛠️ How to Use
Method 1: The Test Explorer (Recommended)
- Open the Testing tab in the sidebar (Beaker icon).
- Expand the folders to see your test files, test functions, and individual subtests.
- Click the Play button next to any test item to execute it, or use the Debug button to debug it.
Method 2: From the Editor Gutter
- Next to any
func TestXxx(t *testing.T)declaration or individual table-test struct case ({ name: "..." }), click the Play button in the margin to run just that specific test.
Method 3: From the Editor Tab / Context Menu
- While editing any
*_test.gofile, click the Play icon in the editor's title bar (top right). - Alternatively, right-click the file in the Explorer side bar and select Run Go Test File.
📋 Requirements
- VS Code
^1.85.0 - Go toolchain installed and available in your system path (
go test).
📄 Changelog
See CHANGELOG.md for details.