A CLI tool that wraps gdUnit4 test framework for Godot Engine. It discovers the Godot project root, executes tests via GdUnitCmdTool.gd, and outputs structured JSON results.
- Single binary — no runtime dependencies, just download and run
- Cross-platform — Linux and Windows support
- Auto-detection — automatically finds
project.godotby walking up from the given path - JSON output — machine-readable test results on stdout for easy CI integration
- Verbose mode — optionally stream raw Godot output to stderr while JSON goes to stdout
Download the latest binary from the Releases page.
go install github.com/minami110/gdunit4-test-runner/cmd/gdunit4-test-runner@latest# Run all tests under tests/ (current directory is used if no path given)
gdunit4-test-runner tests/
# Run tests with a specific Godot binary
gdunit4-test-runner --godot-path /usr/local/bin/godot4 tests/
# Run multiple paths at once
gdunit4-test-runner tests/unit tests/integration
# Run a single test file
gdunit4-test-runner tests/MyTest.gd
# Run tests and stream Godot output to stderr while JSON goes to stdout
gdunit4-test-runner --verbose tests/
# Use current directory (omit path entirely)
gdunit4-test-runner --godot-path /usr/local/bin/godot4
# Parse JSON output with jq
gdunit4-test-runner tests/ | jq .summary| Flag | Default | Description |
|---|---|---|
[paths...] |
. (current dir) |
One or more paths to test directories or files (relative or absolute) |
--godot-path |
(auto) | Path to Godot binary. Overrides GODOT_PATH env and PATH lookup |
--verbose |
false |
Stream raw Godot output to stderr |
| Variable | Description |
|---|---|
GODOT_PATH |
Path to Godot binary. Used when --godot-path is not specified |
| Code | Meaning |
|---|---|
0 |
All tests passed |
1 |
Test failure(s) detected |
2 |
Crash, tool error, or Godot not found |
{
"summary": {
"total": 10,
"passed": 8,
"failed": 2,
"crashed": false,
"status": "failed"
},
"crash_details": null,
"failures": [
{
"class": "TestClass",
"method": "test_method",
"file": "res://tests/TestClass.gd",
"line": 42,
"expected": "foo",
"actual": "bar",
"message": "FAILED: res://tests/TestClass.gd:42"
}
]
}summary.status is one of:
"passed"— all tests passed"failed"— one or more test failures"crashed"— Godot crashed or a script error occurred
- Project detection: Starting from the first given path, walks up the directory tree to find
project.godot. Also verifies thataddons/gdUnit4/is present. - Path conversion: Converts each filesystem path to a
res://-relative path. - Execution: Runs Godot from the project directory:
godot --headless -s res://addons/gdUnit4/bin/GdUnitCmdTool.gd -a <res://path1> -a <res://path2> --ignoreHeadlessMode -c - Output capture: Captures Godot stdout+stderr to a temp log file; if
--verboseis set, also tees to stderr. - Crash detection: Scans the log for
handle_crash:,SCRIPT ERROR:, andERROR:patterns. - Report parsing: Reads
reports/report_*/results.xml(JUnit XML) produced by gdUnit4. - JSON output: Writes structured results to stdout.
--godot-pathflagGODOT_PATHenvironment variablegodotonPATH
- Go 1.24+
make build # Build for current platform
make build-linux # Build for Linux (amd64)
make build-windows # Build for Windows (amd64)
make test # Run tests
make lint # Run go vet
make fmt # Format codeMIT — see LICENSE