[Ethereum] How to unit test smart contracts


How are Ethereum contracts tested? I've seen Truffle which referrers to itself as an Ethereum development framework. Are there any other frameworks and what is their level of maturity? Is there a de facto standard framework used by most contract developers?

How would one go about testing the Greeter contract (https://chriseth.github.io/browser-solidity/) for example?

Best Answer

Via a Framework

There are currently four primary frameworks available that can facilitate writing unit tests for your contracts. Listed in order of Github stars as of 2016-01-25.

Disclaimer: I'm the author of the Populus testing library.


This is the framework with the widest adoption.




Roll your own

You can also roll your own testing framework pretty easily by leveraging either ethereumjs-vm or pytester depending on whether you prefer javascript or python.

Related Topic