Testing blocks
The testing feature allows users to test their smart contracts in a real Tezos environment against a given protocol.
It provides various actions that enable the complete testability of smart contracts.
Create a test suite
The test suite
block is a top-level block that aggregates various testing actions sequentially, allowing the user to validate if the contract is functioning as designed.
Operation Actions
Deploy a contract
A contract origination
creates a new smart contract from a compilation output and specifies its initial amount of tokens and its initial storage.
Call a contract
A contract call
creates a transaction operation, transferring an amount to the recipient contract and executing code if the recipient is an originated contract.
Create a test wallet
This action creates a test wallet
that other actions can use
to validate smart contract conditions. An example is having a test wallet serving as administrator and ensuring that only that wallet can do administrative operations.
Assertion Actions
Assert the contract storage
This action compares the actual storage of a contract against an expected value provided by the user. The assertion expects both values to be identical, otherwise fails.
Assert the contract balance
This action compares the actual balance of a contract against an expected amount provided by the user. The assertion expects both values to be equal, otherwise fails.
Context Actions
Modify chain identifier
Modifies the chain identifier
. It may be useful when testing signatures against replay attacks.
Chain identifier example: NetXynUjJNZm7wi
Macros (Value expansion)
Get address of originated contract / wallet
This macro expands to an actual Tezos address of a contract or account created in the test suite. The address is known only during the execution of the test suite.
Get balance of originated contract / wallet
This macro expands to an actual Tezos amount of a contract or account created in the test suite. The balance is known only during the execution of the test suite.