Skip to main content

Overview

Dokrypt includes a built-in test runner that discovers and executes tests across multiple languages and frameworks. It supports:
  • Automatic discovery — Finds test files by convention
  • Parallel execution — Run tests concurrently
  • Gas reporting — Track gas usage per function
  • Coverage analysis — Measure code coverage
  • Snapshot isolation — Each test gets a clean chain state
  • Built-in validation — Health checks for your chain environment

Test Discovery

Dokrypt automatically finds test files based on these patterns: Default search directories: test/, tests/, contracts/test/

Quick Start

Configuration

Configure test settings in dokrypt.yaml:
CLI flags override config values.

Snapshot Isolation

When --snapshot is enabled (or snapshot_isolation: true in config), each test:
  1. Takes a snapshot before running
  2. Executes the test
  3. Reverts to the snapshot after the test completes
This ensures tests don’t affect each other’s state — every test sees a clean environment.

Gas Reporting

Enable gas tracking to see how much gas each contract function uses:
Output:

Built-in Validation Suite

If no test files are discovered, Dokrypt runs its built-in validation suite to check chain health:

Test Reports

Test results are persisted to ~/.dokrypt/reports/<project>/latest.json. View the last report:

Assertion Helpers (Go SDK)

If building custom test suites using Dokrypt’s Go packages, the testrunner package provides assertion helpers:

Fixtures

The Fixture type provides snapshot-based isolation for individual tests:
Or use the convenience wrapper:

CI Integration

Use JSON output for CI pipelines:
The JSON format includes: