Manual AX-001 · Rev 2026.08 · Classification: harmless
The axonTest framework manual
Testing For Dummies
A field guide to crash-testing Axon code on purpose, in a lab, with dummies—instead of finding out live in production.
Field manual · AX-001Axon code has no compiler standing between it and a live Haystack database. There is no red squiggly line or type checker to stop a typo from becoming a production problem. I built axonTest so those mistakes can happen on purpose, on a schedule, in a disposable sandbox.
Why I made it
Testing an Axon function should not require a pod build, a running server, or a real project full of data that I am nervous about touching. I wanted the smallest useful loop: put a test in a .axon file, point one command at the directory, and get a clear pass, fail, or error.
Every test gets a fresh in-memory Folio. Records, functions, the clock, and HTTP responses can be mocked without leaking into the next test or reaching production. When isolation is no longer enough, the same engine can be installed as an HxLib and deliberately run against a real project in integration mode.
What is in there
- A zero-install command-line runner. One self-contained Fantom file discovers and runs ordinary
.axontest files recursively. - Assertions that read like Axon. Equality, booleans, approximate numbers, expected errors, and an explicit
fail()keep the vocabulary small. - Per-test isolation and mocking. Each test receives a clean database plus hooks for records, functions, time, and real loopback HTTP responses.
- Suites and lifecycle hooks. Several named tests can live together with
beforeTestandafterTest, while every case still receives a fresh context. - Reports for people and machines. The default terminal report separates assertion failures from unexpected errors; JUnit XML and JSON output are ready for CI.
- A project library.
axonTestLibexposes the runner and HTTP helpers as normal Axon functions inside Haxall or SkySpark.
Two ways to run it
The standalone runner is the quick route:
fan axonTest/fan/AxonTest.fan test/examples
Inside a project, the installable library returns the result as a Grid:
libAdd("axonTestLib")
axonTestRun("test/examples")
Integration mode is intentionally explicit. Passing true runs against the project’s live records and functions, which is useful for end-to-end checks and exactly as dangerous as it sounds.
Field note: the example suite contains deliberate failures and an error. It is a crash-test demonstration, not a green CI fixture. Point the runner at your own test directory before wiring it into a build.
The field manual
The accompanying book is the practical guide I wanted beside the framework: quick start first, then reports, CI, assertions, mocking, HTTP, suites, the installable library, integration mode, self-testing, known quirks, and a final cheat sheet.
It keeps the subject approachable without pretending the sharp edges do not exist. Every warning label is there because something behind it can genuinely bite.
Found an error—or want to try it?
Found a loose bolt in the manual, hit an edge case I missed, or want to put axonTest through its paces? Send me a message using the form below. Bug reports, awkward questions, and notes from real Haxall or SkySpark projects are all welcome.