#internet-computer #testing #ic

bin+lib ic-test

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

1 unstable release

new 0.1.0 Apr 3, 2025

#44 in #ic

MIT license

66KB
1.5K 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 uses existing frameworks (pocket-ic and foundry) to read your dfx.json and foundry.toml files, then creates a test setup that works in both environments.

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

  • Rust (1.83+ recommended)
  • DFX SDK for local IC canister builds.
  • Foundry if your tests involve EVM contracts.

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

~87MB
~1.5M SLoC