# Introducing \`ic-test\` – A Tool for Testing Cross-Chain IC Projects

**URL:** <https://forum.dfinity.org/t/introducing-ic-test-a-tool-for-testing-cross-chain-ic-projects/43479>\
**Category:** Developers\
**Tags:** rust\
**Created:** [April 6, 2025, 3:49pm UTC](https://forum.dfinity.org/t/introducing-ic-test-a-tool-for-testing-cross-chain-ic-projects/43479 "2025-04-06T15:49:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sgaflv](https://avatars.discourse-cdn.com/v4/letter/s/f9ae1b/32.png) [@sgaflv](https://forum.dfinity.org/u/sgaflv)\
**Post date:** [April 6, 2025, 3:49pm UTC](https://forum.dfinity.org/t/introducing-ic-test-a-tool-for-testing-cross-chain-ic-projects/43479/1 "2025-04-06T15:49:18Z")

</div>

Hey everyone!

We’re Stan and Ulan, and we’ve been working on a new testing tool called [ic-test](https://github.com/wasm-forge/ic-test) – a command-line utility designed to simplify testing for cross-chain projects written _in Rust_. If you’re working with Internet Computer (IC) canisters and optionally EVM-based contracts, this might be something you’ll find useful.

### What does `ic-test` do?

In short, it automates the boilerplate and setup involved in writing canister and cross-chain integration tests:

- It reads the `dfx.json` and `foundry.toml` files to understand your canister and contract setup.
- It generates Rust types from your Candid `.did` files.
- It creates Solidity interfaces from your contract definitions.
- It sets up the basic API needed to interact with `.wasm` canisters and `.json` contracts for test scenarios.
- It uses `pocket-ic and `foundry` under the hood to actually run the tests.

### How to use it?

- Install the tool: `cargo install ic-test`
- Build your project: `dfx build`

This ensures `dfx` pulls all necessary dependencies and generates the `.wasm` and `.did` files under the `.dfx` folder — which `ic-test` uses to create the test setup.

- Finally, generate the new test project:

```bash
ic-test new tests

```

This creates a new workspace project called `tests`. The test setup is saved in `ic-test.json`.

Inside the `tests` project you will see the bindings generated for each of the project canisters and EVM contracts. If some of the candid files was changed, you can regenerate the bindings with:

```auto
ic-test update

```

The `tests.rs` file containing the actual test logic will not be overwritten by default — unless you explicitly run:

```bash
ic-test update --force

```

### Example: Hello world test

Create a basic rust canister project:

```bash
dfx new hello --type rust

```

Generate the testing project:

```bash
ic-test new

```

Edit the `tests.rs` to do the actual testing. Here’s an example `tests.rs` for a simple “Hello World” project. After some basic adjustments, you might have:

```rust
// ...

async fn setup(test: IcpTest) -> Env {
    let icp_user = test.icp.test_user(0);

    let hello_backend = hello_backend::deploy(&icp_user).call().await;

    let hello_frontend = hello_frontend::deploy(
        &icp_user, // init args
        None,
    )
    .call()
    .await;

    // Additional setup steps
    // ...

    Env {
        test,
        hello_backend,
        hello_frontend,
    }
}

#[tokio::test]

async fn test_greet() {
    let Env {
        test,
        hello_backend,
        hello_frontend,
    } = setup(IcpTest::new().await).await;

    // Call the greet method

    let result: String = hello_backend.greet("ic-test".to_owned()).call().await;
    assert_eq!(result, "Hello, ic-test!");
}

```

Now just run cargo test to see if the test is working.

### Example of testing an EVM contract

For a more advanced example involving an EVM contract, check out the [Co-processor example](https://github.com/wasm-forge/icp-evm-coprocessor-starter) on the testing branch. You’ll need foundry [installed](https://book.getfoundry.sh/getting-started/installation).

```auto
git clone --branch testing https://github.com/wasm-forge/icp-evm-coprocessor-starter

dfx build

forge build

cargo test

```

### ⚠ Still a Work in Progress!

The tool is still under active development and it currently not as user-friendly as one might like, so things might change, and some edges might be rough — but that’s exactly why I’m reaching out.

I’d love your feedback!  
If you try it out and something doesn’t work, or if there’s a feature you wish it had, please let me know.

Thanks for reading! Looking forward to hearing your thoughts and seeing how you use `ic-test` in your projects.

Cheers! 👋

Stan

---

<div class="post-metadata">

**Author:** ![marc0olo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/marc0olo/32/17290_2.png) [@marc0olo](https://forum.dfinity.org/u/marc0olo)\
**Post date:** [July 2, 2025, 9:18am UTC](https://forum.dfinity.org/t/introducing-ic-test-a-tool-for-testing-cross-chain-ic-projects/43479/2 "2025-07-02T09:18:20Z")

</div>

thanks for creating this, @sgaflv! I think it will be very valuable for devs 🙂

@sgaflv as discussed, please make sure to cover missing parts about EVM support in [the docs](https://docs.rs/ic-test)  
(if so)

to everybody else:

- please check out the examples and provide feedback! 😉

---

<div class="post-metadata">

**Author:** ![marc0olo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/marc0olo/32/17290_2.png) [@marc0olo](https://forum.dfinity.org/u/marc0olo)\
**Post date:** [July 2, 2025, 10:08am UTC](https://forum.dfinity.org/t/introducing-ic-test-a-tool-for-testing-cross-chain-ic-projects/43479/3 "2025-07-02T10:08:29Z")

</div>

Also sharing the video presentation here 🙂

[![](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/3X/1/f/1f2eea660982d394256dfd55cf180ba9db675445.jpeg "Multi chain testing support on the Internet Computer") ](https://www.youtube.com/watch?v=FlMZEbN3u2k)
