This directory contains integration tests for the Miden client library. These tests verify the functionality of the client against a running Miden node.
- 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
To install the integration tests binary:
make install-testsThis will build and install the miden-client-integration-tests binary to your system.
The integration tests binary can be run with various command-line options:
miden-client-integration-tests [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
Run all tests with default settings (auto-detected CPU cores):
miden-client-integration-testsRun tests sequentially (no parallelism):
miden-client-integration-tests --jobs 1Run tests with custom parallelism:
miden-client-integration-tests --jobs 8List all available tests without running them:
miden-client-integration-tests --listRun only client-related tests:
miden-client-integration-tests --filter "client"Run tests containing "fpi" in their name:
miden-client-integration-tests --contains "fpi"Exclude swap-related tests:
miden-client-integration-tests --exclude "swap"Run tests with verbose output showing worker information:
miden-client-integration-tests --verboseRun tests against devnet:
miden-client-integration-tests --network devnetRun tests against testnet:
miden-client-integration-tests --network testnetRun tests against a custom RPC endpoint with timeout:
miden-client-integration-tests --network http://192.168.1.100:57291 --timeout 30000Complex example: Run non-swap tests in parallel with verbose output:
miden-client-integration-tests --exclude "swap" --verboseShow help:
miden-client-integration-tests --helpThe 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
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.
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 fn test_my_feature(client_config: ClientConfig) -> Result<()> {
let (mut client, authenticator) = client_config.into_client().await?;
// test logic here
}The build system will automatically discover this function and include it in both the test registry and generate tokio test wrappers.
This project is MIT licensed.