Acton includes a full-featured test runner built specifically for TON smart contract development. Tests are written in Tolk — the same language used for contracts — and run against a local TVM emulator that mirrors the real network’s execution environment. The runner handles everything from simple unit tests to fuzz testing, code coverage, mutation testing, fork testing against live chain state, and an interactive browser-based Test UI.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ton-blockchain/acton/llms.txt
Use this file to discover all available pages before exploring further.
Writing your first test
Test files use the.test.tolk extension and live in the tests/ directory. A test is any get fun whose name starts with test (in backtick notation for multi-word names):
tests/Counter.test.tolk
Running tests
Test attributes
Control test behavior with@test.* attributes placed on get fun declarations:
@test.skip — skip a test
@test.skip — skip a test
@test.only — run only this test
@test.only — run only this test
@test.fuzz — fuzz test with generated inputs
@test.fuzz — fuzz test with generated inputs
Built-in matchers
Transaction matchers
toHaveSuccessfulTx()forcessuccess = trueand defaultsexitCode = 0.toHaveFailedTx()requires a non-zeroexitCode.SearchParamsfields accept either exact values or predicate functions.
Map matchers
Out-action helpers
Out-action indexing is reversed: index
0 is the last produced action.Code coverage
Run tests with--coverage to collect line and branch coverage:
Export coverage data
- LCOV
- Text
- Custom path
Minimum coverage gate
Score column. The run fails if coverage drops below the required percentage.
Coverage in the browser UI
Coverage tab with a sortable file list and per-file source annotation.
Fuzz testing
A fuzz test is a parameterizedget fun with @test.fuzz. Acton generates inputs for each parameter type and re-runs the test until all configured runs pass or one fails:
tests/Counter.test.tolk
fuzz.assume(cond)— discards the current input if the condition is false (does not count as a failure).fuzz.bound(value, min, max)— maps the input into an inclusive range with wrap-around.
coins, bool, string, address, any_address, and nullable versions of each.
Configure project-wide fuzz defaults in Acton.toml:
Acton.toml
Mutation testing
Mutation testing introduces small source-level edits (mutations) — flipping< to >=, removing an assert, swapping + for - — and checks whether your test suite catches them. Surviving mutants reveal gaps in test assertions.
Compilation
Each mutant is compiled. Mutants that fail to compile are reported separately and excluded from the mutation score.
Scope mutation runs
Mutation score gate
Mutation options summary
| Option | Description |
|---|---|
--mutate | Enables mutation testing mode. |
--mutate-contract <NAME> | Contract from Acton.toml to mutate. |
--mutation-diff <MODE> | Limit to worktree, ref, or branch diff. |
--mutation-diff-ref <REF> | Base ref for ref or branch mode. |
--mutation-levels <LEVELS> | Comma-separated levels: critical,major. |
--mutation-workers <N> | Parallelism cap for workers. |
--mutation-minimum-percent <P> | Fail if mutation score is below this threshold. |
--mutation-disable-rules <RULE> | Disable a specific rule. Can repeat. |
Fork testing
Run tests against live testnet or mainnet state by forking the real chain:--fork-net, Acton fetches real account states from the selected network and caches them locally. Tests can then interact with deployed contracts using their actual on-chain state.
Gas profiling
Acton can measure opcode-level gas consumption and compare runs against saved baseline snapshots. Runacton test normally — gas profiling instruments are available inside tests via the standard testing API.
Browser Test UI
Open the interactive browser UI after a test run:--coverage is also passed — a file-by-file coverage view.
Save trace bundles for offline inspection or CI artifacts: