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?


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.

  • 1
    Populus looks cool. I'll also give it a try.
    – hcvst
    Jan 26 '16 at 12:02
  • By all means let me know if you run into any problems. Jan 26 '16 at 15:51
  • 2
    Do any of these frameworks allow systematic testing of the effect of out of Gas exceptions? (I'm thinking that some kind of montecarlo style approach where you check invariants against lots of scenarios might be useful) Feb 25 '16 at 23:34
  • 1
    "Do any of these frameworks allow systematic testing of the effect of out of Gas exceptions?" I'm not exactly sure what you mean by this. I know that with Populus you can test this by seeing that a TransactionError exception is raised as well as verifying that the gasUsed value from the transaction receipt is 100% of the provided gas. Feb 27 '16 at 2:37
  • There's also an option to write UTs in Go, using statically compiled bindings (i.e. code completion) from the .sol files: github.com/ethereum/go-ethereum/wiki/…. I've not found very much documentation on this approach though, would be interested in what others have found.
    – Symmetric
    Jul 8 '17 at 17:35


This is another popular testing library. It has support for TypeScript and works well with HardHat.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.