#canister #testing #test-framework #contract #evm #bindings #deployment #organize #internet-computer #dfx-json

bin+lib ic-test

This tool helps to organize IC Rust canister testing as well as cross-testing between ICP and EVM

13 releases

new 0.1.12 Jun 15, 2025
0.1.11 Jun 14, 2025
0.1.5 May 8, 2025
0.1.4 Apr 29, 2025

#186 in Magic Beans

Download history 103/week @ 2025-03-30 225/week @ 2025-04-06 136/week @ 2025-04-13 21/week @ 2025-04-20 96/week @ 2025-04-27 120/week @ 2025-05-04 49/week @ 2025-05-11 4/week @ 2025-05-18 109/week @ 2025-06-01 450/week @ 2025-06-08

569 downloads per month

MIT license

125KB
3K SLoC

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. The generated bindings and runtime helpers offer:

  • Simplified test project setup.
  • Unified, ergonomic testing interface for IC and EVM components.
  • Static type checking and auto-completion for the canisters under test.
  • A high-level abstraction over deployment and method calls.

Overview

ic-test will:

  • Read dfx.json to gather canister information.
  • Read foundry.toml to gather contract information.
  • Generate Rust type definitions from Candid (.did) files.
  • Generate a contract interface from .sol definitions.
  • Create access API to use existing .wasm canisters and .json contracts for testing.

Requirements

Installation

You can install the tool via Cargo:

cargo install ic-test

Tool usage

Use ic-test by running one of its commands:

ic-test <COMMAND> [OPTIONS]

Create a new test project

ic-test new tests
  • Creates a new test project in the tests folder.
  • Looks for your canisters and contracts, then generates the necessary API bindings and a sample test file.
  • Also creates an ic-test.json file to store generator configuration for future runs.
  • Fails if the tests folder already exists.

Update/regenerate an existing test project

ic-test update

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:

ic-test add contract MyContract

License

This project is licensed under the MIT License. Please see the LICENSE file in this repository for more details.

Dependencies

~42–64MB
~1M SLoC