© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
D. P. BauerGetting Started with Ethereum https://doi.org/10.1007/978-1-4842-8045-4_4

4. Unit Tests for Smart Contracts

Davi Pedro Bauer1  
(1)
Campo Bom, Rio Grande do Sul, Brazil
 

Unit tests are used to test code execution scenarios and ensure that they behave as expected. Crucially, unit tests allow you to refactor code and make new changes without breaking existing behaviors.

In smart contracts, unit tests are even more important, as once the contract is deployed, it is no longer possible to fix it unless you deploy a new contract. Because of this, it is of fundamental importance that you incorporate unit tests into all the smart contracts you write, looking ...

Get Getting Started with Ethereum: A Step-by-Step Guide to Becoming a Blockchain Developer 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.