ek9_run_tests
Compiles and runs the project's @Test programs (auto-forcing -Cd -O0 so coverage probes map to source) and answers status (ok | compile-failed | no-tests-found | tests-failed | coverage-low), tests:{passed, failed}, overallCoverage, results[] per test, plus the inputVariety and hex change-risk blocks.
When to use it
'Do the tests pass?' is one call: {} runs every @Test program in the workspace; testNameFilter:'SmokeTest' (bare or qualified) runs one.
When not to use it
- Running a NORMAL entry-point program (no @Test directive) - use
ek9_run_program. - Compiling tests WITHOUT running them - use
ek9_compilewith includeDev:true. - Wanting the full quality snapshot (coverage + complexity + readability + DI) in one call - use
ek9_run_quality_checks. - Authoring a @Test program rather than running one - use
ek9_add_programwith isTest:true.
Details
In-process CompilationPipeline (bootstrap → discover → compile → runTests), the tests themselves in a fresh child JVM per run, killed at the test time limit (E82001); no pre-compiled workspace needed. status ∈ {ok, compile-failed, no-tests-found, tests-failed, coverage-low}; 'ok' requires all tests green AND coverage at or above the 80% threshold (coverageSufficient). Every run with results carries 'inputVariety' and a 'hex' change-risk block (hazard x exposure, worst construct named, caMax blast radius) - read hex before editing; verbosity:'full' adds per-method/branch/statement uncovered items with file+line (CLI -t4/-t5 data) and the full ranked hex construct list; the invariant interpretation prose only with notes:true.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
coverageDetail | boolean | Retained boolean alias for verbosity:'full'. | |
file | string | The entry-point .ek9 source file (absolute, or relative to projectDir). Omit to auto-detect the shallowest non-dev .ek9 file. | |
generateReport | boolean | Default false. When true, additionally produces an HTML coverage report at .ek9/coverage/index.html. | |
notes | boolean | Default false. When true, include the full interpretation prose beside the metric blocks (how to read hex/hexMax/bands/cohorts, why Ca and purity sit outside the score, what asserted variety means). It is invariant text and ~1,300 tokens, so it is omitted by default and every block instead carries a one-line pointer. The same guidance is permanently available via ek9_help with keyword 'hex' - prefer that once, over paying for it on every run. | |
projectDir | string | Project root holding the .ek9 sources - absolute, or relative to the workspace root. Omit to use the workspace root itself (the first root ek9_compile was given). | |
testGroupFilter | string | Run only tests in the named group. Tests without the group are skipped. | |
testNameFilter | string | Run only this test: a fully qualified name (com.acme::SmokeTest) or a bare program name (SmokeTest) when it is unique across the workspace - an ambiguous bare name is refused naming the candidates. | |
verbosity | string: full | summary | none | Response size. summary (default): counts, per-test results, the hex and inputVariety headlines. full: also a 'coverage' block of every UNCOVERED method / branch / statement with file + line (the CLI -t4/-t5 data) and hex.constructs[], the full ranked per-construct list with raw signals. none: status and counts only. |
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it. 3 of the 4 recorded are shown.
Run tests shape
Request
{
"projectDir" : "<workspace-root>"
}
Response
{
"buildLog" : "Bootstrap: Initialising compiler\nBootstrap: Compiler ready\nDiscovery: Scanning for .ek9 files\nDiscovery: 1 source file(s)\nCompile: Compiling 1 source file(s)\nCompile: Compilation succeeded\nTest: Discovering tests\nTest: No tests found\n",
"compileSucceeded" : true,
"coverageSufficient" : true,
"hex" : {
"available" : false,
"reason" : "no per-construct metrics were registered - typically no tests ran; caMax may still be present (notes:true for the full reason)."
},
"inputVariety" : {
"assertedPercent" : 0.0,
"assertionValidatedTests" : 0,
"constructCount" : 0,
"constructs" : [ ],
"drivenPercent" : 0.0,
"interactionNote" : "no target, deliberately - compare a callable against ITSELF over time; notes:true for why.",
"note" : "omitted (invariant, ~1,300 tokens): pass notes:true, or ek9_help keyword 'hex' once.",
"outputValidatedTests" : 0,
"totalAsserted" : 0,
"totalDriven" : 0,
"totalDrivenPairs" : 0,
"totalFloor" : 0,
"totalPairCeiling" : 0
},
"mainSource" : "seed.ek9",
...
Cut short here: 17 more lines. The whole recorded call.
Run tests stale after edit
Request
{
"coverageDetail" : true,
"projectDir" : "<workspace-root>"
}
Response
{
"buildLog" : "Bootstrap: Initialising compiler\nBootstrap: Compiler ready\nDiscovery: Scanning for .ek9 files\nDiscovery: 2 source file(s)\nCompile: Compiling 2 source file(s)\nCompile: Compilation succeeded\nTest: Discovering tests\nTest: Running 1 test(s)\nTest: 1 passed, 0 failed\n",
"compileSucceeded" : true,
"coverage" : {
"coveredBranches" : 0,
"coveredLines" : 2,
"coveredMethods" : 2,
"overallCoverage" : 50.0,
"totalMethods" : 5,
"uncoveredBranches" : [ ],
"uncoveredMethods" : [ {
"endLine" : 7,
"file" : "main.ek9",
"module" : "probe.stale",
"name" : "Gadget.$",
"startLine" : 7
}, {
"endLine" : 7,
"file" : "main.ek9",
"module" : "probe.stale",
"name" : "Gadget.$$",
"startLine" : 7
}, {
"endLine" : 7,
...
Cut short here: 164 more lines. The whole recorded call.
Run tests coverage detail
Request
{
"coverageDetail" : true,
"projectDir" : "<workspace-root>"
}
Response
{
"buildLog" : "Bootstrap: Initialising compiler\nBootstrap: Compiler ready\nDiscovery: Scanning for .ek9 files\nDiscovery: 2 source file(s)\nCompile: Compiling 2 source file(s)\nCompile: Compilation succeeded\nTest: Discovering tests\nTest: Running 1 test(s)\nTest: 1 passed, 0 failed\n",
"compileSucceeded" : true,
"coverage" : {
"coveredBranches" : 0,
"coveredLines" : 2,
"coveredMethods" : 2,
"overallCoverage" : 33.333333333333336,
"totalMethods" : 6,
"uncoveredBranches" : [ ],
"uncoveredMethods" : [ {
"endLine" : 7,
"file" : "main.ek9",
"module" : "probe.coverage",
"name" : "Widget.$",
"startLine" : 7
}, {
"endLine" : 7,
"file" : "main.ek9",
"module" : "probe.coverage",
"name" : "Widget.$$",
"startLine" : 7
}, {
"endLine" : 7,
...
Cut short here: 200 more lines. The whole recorded call.
See also
- Show me in the IDE: Chapter 5: tests, built
- Show me in the IDE: Chapter 23: running the tests, and the Journal
- Part of the release workflow: Bump version + run tests with coverage + build artefact + install locally + verify.
- Part of the feature_branch_start workflow: Set feature-branch version + add new dependencies + resolve + verify.