Repository navigation
development testing
How Solomon tests are organized, which style to use, and shared helpers. Commands and CI: Building and releases.
| Rule | Detail |
|---|---|
| Location | All Go tests in top-level test/, package name test
|
| Colocation | Do not add *_test.go next to internal/ sources |
| Enforcement |
test/test_layout_test.go checks Go's go list -test ./... metadata and fails when Go detects tests outside test/
|
| Init |
test/init_test.go — TestMain sets logging for the suite |
| CI |
go vet ./..., documentation/package checks, and tests; Linux runs CGO_ENABLED=1 go test ./... -count=1 -race -timeout 20m, while macOS/Windows run go test ./... -count=1 (release.yml) |
Run everything:
go test ./... -count=1
CGO_ENABLED=1 go test ./... -count=1 -race -timeout 20m # Linux CI parityFocused:
go test ./test -run TestSlashDispatch -count=1
go test ./test -run TestLegacy -count=1
go test ./test -run TestRepl -count=1The Linux race suite uses a 20-minute package timeout because the shared test/ package includes integration tests that compile and run sandbox scripts. The race detector and all assertions remain enabled.
| Level | Use when | Typical setup |
|---|---|---|
| Pure unit | Parsers, labels, glob, legacy XML, atmention scoring | Call internal/ directly; no disk/network |
| Component | Slash handlers, editor keys, completion |
testDeps, *ForTest
|
| HTTP stub | LLM resilience, Anthropic/OpenAI streams, Codex request shape |
httptest.Server, mock OpenAI client |
| Filesystem |
editFile, skills registry, chatstore paths |
t.TempDir(), temp project root |
| Minimal runtime | Turn resolution, legacy force, tool routing |
&agentruntime.Runtime{...} with fields set — no full REPL (legacy_runtime_test.go) |
There is no project-wide mock framework. Prefer real temp dirs and small structs over heavy interfaces.
- File tools (
readFile,editFile,find) — real files undert.TempDir() - Slash dispatch — real handler funcs via
testDeps, capturebytes.BufferonOut - REPL editor —
NewMultilineEditorForTestwith real completion env where needed - Checkpoint staging — temp session dirs (
checkpoint_staging_test.go) - Config load/save — temp
~/.solomonhome when tests override paths
-
LLM HTTP —
httptestservers; never call live provider APIs in CI -
Provider client in slash tests — dummy base URL in
testDeps(http://127.0.0.1:9) -
SaveCfg/ MCP connect — no-op callbacks intestDepsunless the test targets persistence -
Cursor sidecar process — test Go install paths and stream bridge without starting Node when possible (
cursor_paths_test.go)
- Asserting exact ANSI escape sequences — test classification, substrings, or plain
termcolorhelpers - Network to GitHub/releases in unit tests (updater tests stub HTTP)
- Full interactive REPL driving a real TTY
| Helper | File | Purpose |
|---|---|---|
testDeps(sess) |
helpers_test.go |
Minimal commands.Deps for slash tests |
NewMultilineEditorForTest |
editor/editorhistory.go |
Editor buffer, keys, completion without a terminal |
NewInputHistoryForTest |
same | Input/shell history |
ReplCompleteResetGoCacheForTest |
replcomplete/go.go |
Reset go subcommand cache between tests |
testToolOutputService |
tooloutput_test.go |
Tool spill limits |
When REPL behavior needs new assertions, add ForTest exports in editor/editorhistory.go rather than exporting production APIs.
-
Naming:
TestArea_behaviororTestFunction_scenario— match the file you extend (TestSlashDispatch_*,TestResolveTurnInvocations_*) - Regression: bug fix should include a test that fails without the fix
- Table-driven: use when the file already does; not mandatory everywhere
- Parallel: rare; default sequential is fine
-
Cursor bundle:
make test/ CI runcursor_bundlerbefore tests (Makefile)
After make gui-deps, run:
npm --prefix gui test
SOLOMON_TEST_BINARY="$(command -v solomon)" npm --prefix gui run test:mobileThe mobile suite uses playwright-core with an installed Chromium browser.
Set SOLOMON_TEST_BROWSER to the browser executable when it is outside the
usual Linux paths. It starts its own daemon and Vite instance with a temporary
Solomon home, workspace and dependency cache; it does not restart the user's
running daemon. Model catalog and chat replies are fixtures, so the suite does
not make paid inference requests. File saving and terminal PTYs use real APIs.
By default it serves the source frontend in development mode. To check a binary
containing the compiled frontend, set SOLOMON_TEST_MODE=normal and point
SOLOMON_TEST_BINARY at that binary after make gui-build and a Go build.
The suite covers phone portrait/landscape sizes, touch navigation, model menus, photo attachments, IME confirmation, keyboard resizing without losing drafts, SSE replies, file saving, terminal WebSockets and desktop navigation. When a LAN interface is available, it also verifies API/WebSocket access from that host and clipboard copying over HTTP. Device emulation does not replace testing Safari and Android browsers on physical phones.
| Area | Test files | Architecture / debug |
|---|---|---|
| Slash | slash_dispatch_test.go |
Skills and slash |
| Legacy XML |
legacy_tools_test.go, legacy_runtime_test.go
|
Agent turn pipeline |
| REPL / completion |
repl_editor_test.go, repl_complete_*.go, repl_highlight_test.go
|
Runtime — REPL |
| Checkpoints |
checkpoint_truncate_test.go, checkpoint_staging_test.go
|
Checkpoints |
| LLM / stream |
stream_integrity_test.go, api_resilience_*.go, anthropic_*.go
|
LLM layer |
| Tools |
edit_file_test.go, find_test.go, read_file_pagination_test.go
|
Native tools |
| Tool output |
tooloutput_test.go, tool_output_integration_test.go
|
Supporting packages |
| Skills |
skills_test.go, skills_search_test.go
|
Skills and slash |
| MCP |
mcp_config_test.go, mcp_adapter_test.go
|
MCP integration |
| Deep research / web surfaces |
web_surfaces_test.go, research_store_test.go
|
Deep research |
| Auth / Codex |
provider_auth_test.go, codex_*_test.go
|
LLM layer — ChatGPT Sub |
| CI events | cievents_test.go |
Runtime orchestration |
| Cursor |
cursor_paths_test.go, stream_cursor_tool_test.go, cursor_native_display_test.go
|
Cursor integration |
| Local server |
server_runtime_test.go, desktop_config_test.go
|
Local server |
| Updater |
updater_test.go, commands_update_test.go
|
Supporting packages |
When testing turn/cancel behavior:
- User stop uses
context.WithCancelCauseanderrUserStopGeneration(turns.go) — assert onerrors.Is(context.Cause(ctx), ...)if you add cancel tests - Stream integrity rejection must not persist partial assistant content (
stream_integrity_test.go) - Session mutation should go through runtime helpers /
mutateSession, not raw races onSessionin production code - Research status may be polled while its background engine is running;
JobRecordvalues must be updated and returned as independent snapshots. Keep the regression covered byTestDeepResearchRuntimeUsesInternalWebAdaptersand run it under-race.
TypeScript unit tests live under integrations/cursor/test/. Run:
make cursor-proxy-testGo tests cover the bridge and install paths; full Cursor SDK runs are not required in CI for most Go changes.
- Cookbook — what to test when adding features
- Building and releases
- Runtime hub — Debug playbook