Truffle unit tests

I believe software developers are artists, and they love testing their chefd'oeuvres before deploying them. If you’re one of them then that's good news for you, as Truffle allows you to easily test your Solidity smart contract.

Under the hood, Truffle leverages an adapted version of the famous Mochajs (https://mochajs.org/) unit-testing framework to test Solidity contracts. Consequently, you can write your tests in JavaScript and take advantage of all the patterns Mocha provides. In addition, Truffle enables you to write tests using Solidity directly. In this section, I will opt for starting with JavaScript to implement all of the Tontine test cases, then we will explore how to use Solidity as a testing framework.

Let's ...

Get Blockchain By Example 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.