Miden Client Integration Tests
This directory contains integration tests for the Miden client library. These tests verify the functionality of the client against a running Miden node.
Features
- Parallel Execution: Run tests in parallel to significantly reduce total execution time
- Test Filtering: Filter tests by name patterns, categories, or exclude specific tests
- Flexible Configuration: Configurable RPC endpoints, timeouts, and parallel job counts
- Comprehensive Reporting: Detailed test results with timing statistics and progress tracking
- cargo-nextest-like Experience: Similar filtering and execution patterns as cargo-nextest
Installation
To install the integration tests binary:
This will build and install the miden-client-integration-tests binary to your system.
Usage
Running the Binary
The integration tests binary can be run with various command-line options:
Command-Line Options
-n, --network <NETWORK>- The network to use. Options aredevnet,testnet,localhostor a custom RPC endpoint (default:localhost)-t, --timeout <MILLISECONDS>- Timeout for RPC requests in milliseconds (default:10000)-j, --jobs <NUMBER>- Number of tests to run in parallel (default: auto-detected CPU cores, set to1for sequential execution)-f, --filter <REGEX>- Filter tests by name using regex patterns--contains <STRING>- Only run tests whose names contain this substring--exclude <REGEX>- Exclude tests whose names match this regex pattern--list- List all available tests without running them-v, --verbose- Show verbose output including individual test timings and worker information-h, --help- Show help information-V, --version- Show version information
Examples
Run all tests with default settings (auto-detected CPU cores):
Run tests sequentially (no parallelism):
Run tests with custom parallelism:
List all available tests without running them:
Run only client-related tests:
Run tests containing "fpi" in their name:
Exclude swap-related tests:
Run tests with verbose output showing worker information:
Run tests against devnet:
Run tests against testnet:
Run tests against a custom RPC endpoint with timeout:
Complex example: Run non-swap tests in parallel with verbose output:
Show help:
Test Categories
The integration tests cover several categories:
- Client: Basic client functionality, account management, and note handling
- Custom Transaction: Custom transaction types and Merkle store operations
- FPI: Foreign Procedure Interface tests
- Network Transaction: Network-level transaction processing
- Onchain: On-chain account and note operations
- Swap Transaction: Asset swap functionality
Test Case Generation
The integration tests use an automatic code generation system to create both cargo nextest compatible tests and a standalone binary. Test functions that start with test_ are automatically discovered during build time and used to generate:
- Individual
#[tokio::test]wrappers - These allow the tests to be run using standardcargo testorcargo nextest runcommands - Programmatic test access - A
Vec<TestCase>that enables the standalone binary to enumerate and execute tests dynamically with custom parallelism and filtering
The discovery system:
- Scans all
.rsfiles in thesrc/directory recursively - Identifies functions named
test_*(supportingpub async fn test_*,async fn test_*, etc.) - Generates test registry and integration test wrappers automatically
This dual approach allows the same test code to work seamlessly with both nextest (for development) and the standalone binary (for CI/CD and production testing scenarios), ensuring consistent behavior across different execution environments.
Writing Tests
To add a new integration test:
- Create a public async function that starts with
test_ - The function should take a
ClientConfigparameter - The function should return
Result<()> - Place the function in any
.rsfile undersrc/
Example:
pub async
The build system will automatically discover this function and include it in both the test registry and generate tokio test wrappers.
License
This project is MIT licensed.