#internet-computer #testing #contract #ic #ic-test

bin+lib ic-test

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

4 releases

new 0.1.3 Apr 14, 2025
0.1.2 Apr 10, 2025
0.1.1 Apr 10, 2025
0.1.0 Apr 3, 2025

#767 in Magic Beans

Download history 110/week @ 2025-03-31 268/week @ 2025-04-07

378 downloads per month

MIT license

71KB
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 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

~43–64MB
~1M SLoC