https://github.com/lusingander/gotip
Go Test Interactive Picker ๐งช
https://github.com/lusingander/gotip
bubbletea go go-test go-testing golang test tui unit-testing
Last synced: 10 days ago
JSON representation
Go Test Interactive Picker ๐งช
- Host: GitHub
- URL: https://github.com/lusingander/gotip
- Owner: lusingander
- License: mit
- Created: 2025-07-05T07:06:39.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2026-05-03T02:02:46.000Z (about 2 months ago)
- Last Synced: 2026-05-03T04:08:11.432Z (about 2 months ago)
- Topics: bubbletea, go, go-test, go-testing, golang, test, tui, unit-testing
- Language: Go
- Homepage:
- Size: 2 MB
- Stars: 33
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gotip
Go Test Interactive Picker

## About
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)
- List discovered tests in text or JSON format
- Run individual subtests or grouped subtests
- View and re-run tests from execution history
## Installation
```
go install github.com/lusingander/gotip/cmd/gotip@latest
```
## Usage
### Basic usage
In a directory containing a `go.mod` file, run:
```
gotip
```
While a test is selected, press Enter to run it using `go test`.
### Passing additional arguments
You can pass extra flags directly to `go test` by appending them after `--`:
```
gotip -- -v -count=1
```
### Running a parent test group
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.

### Using test history
Press Tab to switch to History view, or launch directly with the `--view=history` option.
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/`.

### Rerunning the last test
You can rerun the last executed test without showing the UI by using the `--rerun` option:
```
gotip --rerun
```
This will immediately execute the most recent test from your history.
### Listing discovered tests
You can inspect the statically discovered test tree without opening the UI:
```
gotip list
```
Example text output:
```text
# ./foo/foo_test.go
- TestFoo
- case1
- case2
- TestBar
```
For machine-readable output, use JSON:
```
gotip list --format=json
```
Example JSON output:
```json
{
"files": [
{
"path": "./foo/foo_test.go",
"tests": [
{
"name": "TestFoo",
"subtests": [
{ "name": "case1", "resolved": true, "subtests": [] }
]
}
]
}
]
}
```
The JSON output follows [`schema/list.schema.json`](./schema/list.schema.json).
The `list` command uses the same discovery rules as the TUI, including subtest inference and `--skip-subtests`.
### Options
```
Usage:
gotip [OPTIONS] [list]
Application Options:
-v, --view=[all|history] Default view (default: all)
-f, --filter=[fuzzy|exact] Default filter type (default: fuzzy)
-s, --skip-subtests Skip subtest detection
-r, --rerun Rerun the last test without showing the UI
-V, --version Print version
Help Options:
-h, --help Show this help message
Available commands:
list List discovered tests
```
`gotip list --help` shows options specific to the non-interactive listing command:
```
Usage:
gotip [OPTIONS] list [list-OPTIONS]
[list command options]
-s, --skip-subtests Skip subtest detection
--format=[text|json] Output format (default: text)
```
### Config
gotip supports both global and project-specific configuration.
- Global config
- Place your global config at `~/.config/gotip/gotip.toml`. This applies to all projects.
- Project config
- Place a `gotip.toml` file in your current working directory. This applies only to the current project.
If both global and project configs exist, they are merged.
For overlapping keys, the project config takes precedence.
The format is as follows:
```toml
# Specifies the command used to run tests.
# If omitted, the default command is used.
# type: list of strings
command = []
# Specify file path patterns to exclude from processing using the .gitignore format.
# https://git-scm.com/docs/gitignore/en#_pattern_format
# type: list of strings
ignore = []
[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"
```
#### `command`
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](https://github.com/gotestyourself/gotestsum), you can configure it like this:
```toml
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:
```toml
command = ["go", "test", "-run", "${name}", "${package}"]
```
### Keybindings
| 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 |
| ? | Show help |
## Planned features
- Launch with initial filter based on package or test name
- Custom keybindings
## License
MIT