Acton
Testing

Test Configuration

Learn how to configure test runner behavior through project settings and command line options

Test runner provides flexible configuration options that allow you to set default test behavior in your project configuration file and override it as needed via command line flags. This approach helps maintain consistent testing practices across your project while still allowing per-run customization.

Configuration Methods

Acton supports two methods for configuring test behavior:

  1. Project Configuration — Set defaults in Acton.toml for consistent behavior
  2. Command Line Flags — Override configuration for specific test runs

Configuration Precedence

When both methods are used, the precedence order is:

  1. Command line flags (highest priority) — override everything
  2. Acton.toml settings (medium priority) — project defaults
  3. Built-in defaults (lowest priority) — fallback values

Project Configuration in Acton.toml

Basic Configuration

Add a [test] section to your Acton.toml file to configure default test behavior:

Acton.toml
[package]
name = "my-ton-project"
version = "0.1.0"

[test]
# Enable detailed backtraces
backtrace = "full"

[test.fuzz]
# Use 512 accepted inputs for fuzz tests marked with @test.fuzz
runs = 512
# Fix the seed for reproducible fuzz runs
seed = 42

[test.coverage]
# Enable code coverage by default
enabled = true
format = "lcov"

Command Line Override

Any configuration option can be overridden via command line flags:

# Use specific reporter
acton test --reporter console

# Compact progress reporter
acton test --reporter dot

# Use multiple reporters
acton test --reporter console,junit

# TeamCity with console output
acton test --reporter console,teamcity

# Override coverage setting from config
acton test --coverage

# Override filter setting from config
acton test --filter "mint.*"

# Override reporter setting
acton test --reporter teamcity

# Multiple overrides
acton test --coverage --filter "test deploy" --debug --reporter junit

Configuration Options Reference

Filter Options

ConfigurationCLI FlagTypeDescription
filter--filterStringRegex pattern to filter test names
exclude--excludeArrayGlob patterns to exclude test files
include--includeArrayGlob patterns to include only test files

Examples:

[test]
filter = ".*wallet.*"              # Only get fun `...wallet...`
exclude = ["**/integration/**"]    # Skip integration directory
include = ["**/unit/**"]           # Only include unit test files

Execution Options

ConfigurationCLI FlagTypeDescription
fail-fast--fail-fastBooleanStop executing tests after the first failure

Examples:

[test]
fail-fast = true

Reporter Options

ConfigurationCLI FlagTypeDescription
reporter--reporterArrayTest output format(s)

Supported reporters:

  • console — Detailed console output with code context (default)
  • teamcity — TeamCity CI integration (minimal output, best combined with console)
  • junit — JUnit XML reports for external tools
  • dot — Compact dot-style progress with detailed failure diagnostics at the end

TeamCity Integration

When using TeamCity CI, combine teamcity with console reporter to see detailed test output alongside CI integration data.

acton test --reporter console,teamcity

Examples:

[test]
# Use multiple reporters
reporter = ["console", "junit"]

# Single reporter
reporter = ["teamcity"]

# Compact progress reporter
reporter = ["dot"]

# For TeamCity CI, combine with console for detailed output
reporter = ["console", "teamcity"]

Debug Options

ConfigurationCLI FlagTypeDescription
debug--debugBooleanEnable debug mode
debug-port--debug-portIntegerDebug server port
backtrace--backtraceStringEnable stack traces ("full")
---verboseCountEnable level-1 executor debug logs (CLI only)

--verbose is currently binary in practice: default level 0, and level 1 when --verbose is passed once. Higher user-selected levels are not supported yet.

Examples:

[test]
debug = false
debug-port = 12345
backtrace = "full"
acton test --verbose --filter "debug.*"

Coverage Options

ConfigurationCLI FlagTypeDescription
[test.coverage].enabled--coverageBooleanEnable code coverage
[test.coverage].format--coverage-formatStringCoverage output format (lcov, text)
[test.coverage].output-file--coverage-fileStringPath to save the coverage report
[test.coverage].include-wrappers--coverage-include-wrappersBooleanInclude files from the @wrappers mapping in coverage reports
[test.coverage].include-tests--coverage-include-testsBooleanInclude .test.tolk files in coverage reports

Examples:

[test.coverage]
enabled = true
format = "lcov"
include-wrappers = true
include-tests = true

Fuzz Options

These defaults apply only to parameterized tests that explicitly opt in with @test.fuzz, @test.fuzz(<runs>), or @test.fuzz({ ... }). Per-test annotations can override them with @test.fuzz({ runs: ..., max_test_rejects: ..., seed: ... }). When max-test-rejects is omitted, Acton uses runs * 256.

See Fuzz Testing for annotation syntax, helper APIs, supported parameter types, and failure reporting.

ConfigurationCLI FlagTypeDescription
[test.fuzz].runs-IntegerNumber of accepted fuzz cases to execute for each fuzz test
[test.fuzz].max-test-rejects-IntegerMaximum assume(...) rejections before the fuzz test fails
[test.fuzz].seed--fuzz-seedIntegerSeed for reproducible fuzz input generation

Examples:

[test.fuzz]
runs = 512
max-test-rejects = 4096
seed = 42

Profiling Options

ConfigurationCLI FlagTypeDescription
fail-on-diff--fail-on-diffBooleanExit with non-zero code when profiling differs from baseline snapshot

fail-on-diff is applied when running baseline comparison mode with --baseline-snapshot <FILE>.

Examples:

[test]
fail-on-diff = true
acton test --baseline-snapshot gas-baseline.json --fail-on-diff

JUnit Options

ConfigurationCLI FlagTypeDescription
junit-path--junit-pathStringJUnit XML output directory
junit-merge--junit-mergeBooleanMerge all suites into one file
fork-net--fork-netStringNetwork to fork from

Fork Testing Options

ConfigurationCLI FlagTypeDescription
fork-net--fork-netstringNetwork name to fork state from (mainnet, testnet, or a custom network defined in [networks]).
fork-block-number--fork-block-numberintegerSpecific block number to fork from.

Examples:

[test]
fork-net = "mainnet"

Use TONCENTER_TESTNET_API_KEY or TONCENTER_MAINNET_API_KEY in the environment when the built-in fork target needs TonCenter authentication.

Using a custom network:

[networks.my-local-node]
api = { v2 = "http://localhost:8081/api/v2/jsonRPC" }

[test]
fork-net = "my-local-node"

Examples:

[test]
# Custom JUnit output directory
junit-path = "custom-reports"
junit-merge = true

Last updated on

On this page