As in the title, I would like to know if there is any framework/library/tool in order to write and launch unit tests for smart contracts.
In comparison with Solidity, I am referring to something similar to Brownie, HardHat, Truffle.
With these frameworks it is possible to create a clean environment by deploying smart contracts and rolling back to this state at the end of each test.
Also I was wondering if there was a way to reduce the commitment time for transactions to 0 (I’m using the official Sandbox) because increasing the tests and therefore the transactions also dramatically increases the time needed to perform them.
I’m currently using this function (Python SDK) transaction.wait_for_confirmation(client, tx_id, 2)
to make sure the transaction took place before continuing and this takes some time.
If you use sandbox
in dev
mode, then every transaction creates a block. So no wait needed.
AlgoPyTest makes it simpler to write unit tests: Welcome to AlgoPytest’s documentation! — AlgoPytest documentation
Finally, graviton allows you to make more fine-grained testing of smart contracts:
It is however in beta and may change in the future.
1 Like