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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.