diff --git a/src/pages/cw-multi-test.mdx b/src/pages/cw-multi-test.mdx index edde3f42..4e98c786 100644 --- a/src/pages/cw-multi-test.mdx +++ b/src/pages/cw-multi-test.mdx @@ -4,30 +4,37 @@ tags: ["multitest"] import { Callout } from "nextra/components"; +[file an issue]: https://github.com/CosmWasm/cw-multi-test/issues + # Introduction -**`MultiTest`** is a suite of testing tools designed for facilitating multi-contract interactions +**`MultiTest`** is a suite of testing tools designed to facilitate multi-contract interactions within the CosmWasm ecosystem. Its primary focus is on providing developers with a robust framework -for testing complex contract interactions and several Cosmos modules operations. +for testing complex smart contract interactions and operations involving various Cosmos modules. - MultiTest is a **simulator** of the blockchain, allowing tested smart contracts to interact as if - they were operating on the real-life blockchain. + **`MultiTest`** is a blockchain **SIMULATOR**, allowing tested smart contracts to interact as if + they were operating on a real blockchain. -The most valuable advantage of using **`MultiTest`** is that it allows you to test and debug smart -contracts with access to Rust source code, eliminating the need to run a complete blockchain node to -begin designing smart contract functionality. +The most valuable advantage of using **`MultiTest`** is that it allows testing and debugging of +smart contracts with access to the Rust source code, eliminating the need to run a complete +blockchain node to begin designing the smart contract functionality. Additionally, **`MultiTest`** +enables the execution of tests significantly faster than on a real blockchain, as it bypasses the +overhead associated with network consensus and block production. This results in a more efficient +development cycle, allowing for quicker iterations and faster identification of issues. + +While **`MultiTest`** is a blockchain **SIMULATOR**, it may happen, that the behavior of the real +blockchain might slightly differ in some edge cases. We strongly encourage you to [file an issue] +with a detailed description of such use case to help us improve the **`MultiTest`**. -The disadvantage is that **`MultiTest`** is a blockchain simulator, and it is possible that the -behavior of the real-life blockchain may slightly differ in edge cases from the simulated model. In -such cases, we strongly encourage you to -[file an issue](https://github.com/CosmWasm/cw-multi-test/issues) with a detailed description of the -use case to help us improve **`MultiTest`**. +In the upcoming chapters, we provide detailed instructions on installing and getting started with +**`MultiTest`**, writing unit tests for smart contracts, testing complex interactions between smart +contracts and testing smart contract interactions with Cosmos modules. -In the upcoming chapters, we will provide detailed instructions on installing and getting started -with **`MultiTest`**, writing unit tests for smart contracts, testing complex interactions between -smart contracts and testing smart contract interactions with Cosmos modules. +By the end of these chapters, you will have a comprehensive understanding of how to use +**`MultiTest`** for testing and debugging smart contracts in various scenarios. -By the end of these chapters, you will have a comprehensive understanding of using **`MultiTest`** -for testing and debugging smart contracts in various scenarios. + + To successfully follow the upcoming chapters, a basic knowledge of Rust and Cargo is required. + diff --git a/src/pages/cw-multi-test/features.mdx b/src/pages/cw-multi-test/features.mdx index ce8a4886..334ec685 100644 --- a/src/pages/cw-multi-test/features.mdx +++ b/src/pages/cw-multi-test/features.mdx @@ -4,23 +4,30 @@ tags: ["multitest", "features"] # Features -## Functionalities +All **`MultiTest`** features a listed in the following table. The **"Default implementation"** +column indicates whether the feature has a default implementation in **`MultiTest`** that simulates +the functionality of the real blockchain as closely as possible. In cases where **`MultiTest`** does +not have a default implementation for the feature, users may provide their own, using `AppBuilder`'s +function listed in **"AppBuilder constructor"** column. Names of **`MultiTest`** feature flags +required to enable specific functionality are provided in the column **"Feature flag"**. -| Functionality | Impl | Feature | AppBuilder | Testing purpose | -| ------------- | ------- | ---------- | ------------------- | ------------------------------------------- | -| Block | **YES** | | `with_block` | Operations on blocks. | -| API | **YES** | | `with_api` | Access to CosmWasm API. | -| Storage | **YES** | | `with_storage` | Access to storage. | -| Bank | **YES** | | `with_bank` | Interactions with **Bank** module. | -| Staking | **YES** | `staking` | `with_staking` | Interactions with **Staking** module. | -| Distribution | **YES** | `staking` | `with_distribution` | Interactions with **Distribution** module. | -| Governance | **NO** | | `with_gov` | Interactions with **Governance** module. | -| Stargate | **NO** | `stargate` | `with_stargate` | Operations with
Stargate/Any messages. | -| Wasm | **YES** | | `with_wasm` | Interactions with **Wasm** module. | -| Custom | **NO** | | `new_custom` | Operations on custom module. | -| IBC | **NO** | `stargate` | `with_ibc` | Inter-blockchain communication operations. | +| Feature | Default
implementation | Feature
flag | AppBuilder
constructor | Functionality | +| ------------ | :------------------------: | :--------------: | -------------------------- | -------------------------------------------------- | +| Block | **YES** | | `with_block` | Operations on blocks. | +| API | **YES** | | `with_api` | Access to CosmWasm API. | +| Storage | **YES** | | `with_storage` | Access to storage. | +| Bank | **YES** | | `with_bank` | Interactions with **Bank** module. | +| Staking | **YES** | `staking` | `with_staking` | Interactions with **Staking** module. | +| Distribution | **YES** | `staking` | `with_distribution` | Interactions with **Distribution** module. | +| Governance | **NO** | | `with_gov` | Interactions with **Governance** module. | +| Stargate | **NO** | `stargate` | `with_stargate` | Operations using `Stargate` and/or `Any` messages. | +| Wasm | **YES** | | `with_wasm` | Interactions with **Wasm** module. | +| Custom | **NO** | | `new_custom` | Operations using custom module. | +| IBC | **NO** | `stargate` | `with_ibc` | Inter-blockchain communication operations. | -## Feature flags +## Feature flags summary + +The following table summarizes all the feature flags supported by **`MultiTest`**. | Feature flag | Description | | -------------- | ------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/src/pages/cw-multi-test/installation.mdx b/src/pages/cw-multi-test/installation.mdx index 08bb2516..748a4dbf 100644 --- a/src/pages/cw-multi-test/installation.mdx +++ b/src/pages/cw-multi-test/installation.mdx @@ -4,13 +4,18 @@ tags: ["multitest", "installation"] import { Callout } from "nextra/components"; +[rustup installer]: https://rustup.rs +[Rust and Cargo]: https://www.rust-lang.org/tools/install +[Tarpaulin]: https://github.com/xd009642/tarpaulin +[Nextest]: https://nexte.st +[cw-multi-test]: https://crates.io/crates/cw-multi-test + # Installation -**`MultiTest`** ships as a Rust library named -[cw-multi-test](https://crates.io/crates/cw-multi-test). +**`MultiTest`** ships as a Rust library named [cw-multi-test]. -To use **`MultiTest`** for building and testing smart contracts, add it as a **development -dependency** to your project: +To use **`MultiTest`** for testing smart contracts, add it as a **DEVELOPMENT DEPENDENCY** to your +project: ```toml filename="Cargo.toml" [dev-dependencies] @@ -18,18 +23,22 @@ cw-multi-test = "2" ``` - **`MultiTest`** is a _**testing**_ library and should always be added to your project as + **`MultiTest`** is a **TESTING** library and should always be added to your project as **DEVELOPMENT DEPENDENCY** in section **`[dev-dependencies]`** of the **Cargo.toml** file. -### Prerequisities +## Prerequisities + +The only prerequisite to test smart contracts using **`MultiTest`** is having [Rust and Cargo] +installed. -The only prerequisite to build and test smart contracts using **`MultiTest`** is having -[Rust and Cargo](https://www.rust-lang.org/tools/install) installed. + + We recommend installing Rust using the official [rustup installer]. This makes it easy to stay on + the most recent Rust version. + -Optionally, you may want to install [Tarpaulin](https://github.com/xd009642/tarpaulin) for measuring -code coverage and [Nextest](https://nexte.st) for running tests faster, with clean and beautiful -user interface. +Optionally, you may want to install [Tarpaulin] for measuring code coverage and [Nextest] for +running tests faster, with clean and beautiful user interface. Installing **Tarpaulin**: