#internet-computer #testing #contract #ic

bin+lib ic-test

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

6 releases

new 0.1.5 May 8, 2025
0.1.4 Apr 29, 2025

#213 in Magic Beans

Download history 124/week @ 2025-04-02 307/week @ 2025-04-09 52/week @ 2025-04-16 46/week @ 2025-04-23 75/week @ 2025-04-30

487 downloads per month

MIT license

115KB
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.

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

~40–63MB
~1M SLoC