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 indokrypt.yaml:
Snapshot Isolation
When--snapshot is enabled (or snapshot_isolation: true in config), each test:
- Takes a snapshot before running
- Executes the test
- Reverts to the snapshot after the test completes
Gas Reporting
Enable gas tracking to see how much gas each contract function uses: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, thetestrunner package provides assertion helpers:
Fixtures
TheFixture type provides snapshot-based isolation for individual tests: