Testing Smart Contracts with Solo
What is Solo?
Solo is a testing framework that allows developers to validate real smart contracts and entire inter-chain protocols before deploying them on the distributed network.
Installation
Prerequisites
Go (version 1.20). As Solo tests are written in Go, you must install Go.
Access the Solo Framework
You can access the Solo package by cloning the Wasp repository or installing the Solo package.
Clone the Wasp Repository
Solo is part of the WaspWasp is the node software that implements Smart Contracts on the Tangle. codebase repository. You can access the Solo framework by cloning the repository with the following command:
git clone https://github.com/iotaledger/wasp.git
After you have cloned the repository, you can access the Solo package in the /packages/solo
folder.
Install the Solo Package
You can install the Solo package separately using the following command:
go get github.com/iotaledger/wasp/packages/solo
You can browse the Solo Go API reference (updated to the master
branch) in
go-docs.
Example Contracts
You will need a smart contract to test along with Solo. You can find example implementations of Wasm smart contracts, including source code and tests, in the Wasp repository’s contracts/wasm folder.
The following sections will present some Solo usage examples. You can find the example code in the Wasp repository.
Run *_test
Files
You can run *_test
files by moving to their directory and running the following command:
go test
If you run this command from the /documentation/tutorial-examples
folder, you will run the
Tutorial Test,
which contains all the examples explained in the following sections.