Run Only Affected Tests
Affected-test selection trims the test set by comparing local changes against a static Apex reference graph. It is designed for the inner loop: run the tests most likely to observe the files you changed.
Changed file -> Apex reference graph -> selected testsChanged files from git
Use glade test changed --since <ref> to compare tracked project files against a git ref:
glade test changed --project . --since origin/main --json --no-progressA changed production class selects tests that reference it. A changed test class selects itself. Metadata and unknown file types fall back to conservative behavior.
Watch and one-shot modes
Use watch mode during editing:
glade test --project . --watchUse one-shot watch mode for tools that want a single affected run:
glade test --project . --watch-onceUse the daemon when repeated parsing and graph rebuilds would cost too much inside one watch process:
glade test --project . --daemon --watchUse glade test serve when separate CLI invocations should stay warm across terminals or editor tasks.
Selection modes
The affected-test report distinguishes three useful outcomes:
direct— tests selected from direct references to changed Apex symbols.all— the safe fallback when Glade cannot narrow the impact.none— no tests selected for the observed change set.
none means Glade did not find tests affected by the current change set.
{
"mode": "direct",
"changed": ["force-app/main/default/classes/RefinementService.cls"],
"tests": ["RefinementServiceTest"]
}NDJSON watch events
Daemon and watch flows can emit newline-delimited JSON events for editors and automation. Consumers should treat each line as one event and avoid depending on human console text.
A typical event stream contains file-change notices, selection summaries, run starts, per-test outcomes, diagnostics, and run completion records.
glade test --project . --watch --jsonPractical recipes
Before opening a pull request:
glade check --project . --json --no-progress
glade test changed --project . --since origin/main --json --no-progress
mkdir -p reports
glade test --project . --junit reports/glade-junit.xmlDuring a focused edit:
glade test --project . --class RefinementServiceTest --watchWhen Glade cannot prove a smaller safe set, it runs more tests rather than risk missing a failure.