Chapter 10. Unit testing contracts with Mocha

This chapter covers
  • Installing and setting up Mocha, a JavaScript unit testing framework
  • Unit testing SimpleCoin with Mocha
  • Writing tests performing negative checks, verifying expected exceptions are thrown
  • Writing tests performing positive checks, verifying logic is executed successfully

In previous chapters, you learned how to develop an Ethereum Dapp by using simple tools that the platform offers. You were able, with some effort, to build an end-to-end Dapp, including a simple web UI and a smart contract layer (including libraries) and to deploy it to the public test network. You wrote Solidity and Web3.js code through Remix or even through plain text editors and launched ...

Get Building Ethereum Dapps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.