ic-test
ic-test is a command-line tool that helps you organize the test workflow for cross-chain projects on the Internet Computer (IC). It reads your dfx.json and foundry.toml files to automatically create testing base and uses existing frameworks (pocket-ic and foundry) to execute tests.
Overview
ic-test will:
- Read
dfx.jsonto gather canister information. - Read
foundry.tomlto gather contract information. - Generate Rust type definitions from Candid (
.did) files. - Generate a contract interface from
.soldefinitions. - Create access API to use existing
.wasmcanisters and.jsoncontracts for testing.
Requirements
Installation
You can install the tool via Cargo:
Tool usage
Use ic-test by running one of its commands:
Create a new test project
- Creates a new test project in the
testsfolder. - Looks for your canisters and contracts, then generates the necessary API bindings and a sample test file.
- Also creates an
ic-test.jsonfile to store generator configuration for future runs. - Fails if the
testsfolder already exists.
Update/regenerate an existing test project
Reruns the generator based on the configuration in ic-test.json.
Manually add canister or contract
For a given Solidity contract name if will try to find its json implementation. Example:
License
This project is licensed under the MIT License. Please see the LICENSE file in this repository for more details.