Testing smart contracts

Testing tools and libraries

Two testing frameworks are provided as to be used for different purposes: one is for unit testing and the other is for integration testing.

Unit testing

The javaee-unittest artifact is used to perform unit testing.
Here are the sample unit test cases.

Integration testing

The testinteg subproject can be used for the integration testing. It assumes there is a running ICON network (either local or remote) that can be connected for the testing. It uses the ICON Java SDK (foundation.icon:icon-sdk:2.0.0) to interact with the network. The default configuration is for gochain-local network. If you want to change this configuration, either modify the configuration file directly or set the proper system property (env.props) when you run the integration testing (see example).
Here are the sample integration test cases.
Use integrationTest task to run the integration testing. Here is the example of invoking the MultisigWallet integration testing.
$ ./gradlew multisig-wallet:integrationTest