Go Test Interactive Picker
gotip is a TUI application for interactively selecting and running Go tests.
Key features:
- Fuzzy filtering of test cases
- Detection of subtest names defined via table-driven tests (partial support)
- Run individual subtests or grouped subtests
- View and re-run tests from execution history
go install github.com/lusingander/gotip/cmd/gotip@latest
In a directory containing a go.mod
file, run:
gotip
While a test is selected, press Enter to run it using go test
.
You can pass extra flags directly to go test
by appending them after --
:
gotip -- -v -count=1
While a test is selected, press Backspace to move up to its parent test group.
This allows you to execute all subtests under that group.
For example, if you have TestFoo/Bar/Baz
selected, pressing Backspace will select TestFoo/Bar
, and running it will execute all tests under that prefix.
If subtest names could not be automatically discovered, gotip defaults to selecting the nearest available parent test.
Press Tab to switch to History view.
In this view, you can select and run tests from your previous execution history, just like in the regular view.
The history data is stored under .local/state/gotip/history/
.
Usage:
gotip [OPTIONS]
Application Options:
-v, --view=[all|history] Default view (default: all)
-f, --filter=[fuzzy|exact] Default filter type (default: fuzzy)
-V, --version Print version
Help Options:
-h, --help Show this help message
You can configure gotip by placing a gotip.toml
file in the current directory.
The format is as follows:
# Specifies the command used to run tests.
# If omitted, the default command is used.
# type: list of strings
command = []
[history]
# Limits the number of test executions to keep in history.
# type: integer
limit = 100
# Format used to display timestamps in the history view.
# Uses Go's time format syntax.
# type: string
date_format = "2006-01-02 15:04:05"
The command
field allows you to customize how tests are executed.
You can use this to always pass specific flags or use an external test runner instead of the default.
For example, to use gotestsum, you can configure it like this:
command = ["gotestsum", "--format", "testname", "--", "-run", "${name}", "${package}"]
${name}
and ${package}
are placeholders that will be replaced at runtime with the selected test name pattern and package name, respectively.
If not specified, the following default command is used:
command = ["go", "test", "-run", "${name}", "${package}"]
Key | Description |
---|---|
Ctrl-c | Quit |
j ↓ | Select next item |
k ↑ | Select previous item |
l → | Select next page |
h ← | Select previous page |
Enter | Run the selected test |
Backspace | Select parent test group |
/ | Enter filtering mode |
Enter | Confirm filter (in filtering mode) |
Esc | Clear filtering mode |
Ctrl-x | Toggle filtering type |
Tab | Switch view |
- Launch with initial filter based on package or test name
- Custom keybindings
MIT