Book Image

Truffle Quick Start Guide

By : Nikhil Bhaskar
Book Image

Truffle Quick Start Guide

By: Nikhil Bhaskar

Overview of this book

Truffle is a world-class development environment, testing framework and asset pipeline for Ethereum, aiming to make life as an Ethereum developer easier. If you are a web developer wanting to try your hand at developing Dapps with Truffle, then this is the book for you. This book will teach you to write smart contracts and build Dapps with Truffle. You will begin with covering the basics of Truffle, briefly explaining how it integrates Solidity and Web3, in orderto start building a mini decentralized application. Also, you will dive into migration, testing and integrating Truffle with the use of popular JavaScript frameworks. Lastly, you will ship your decentralized application and package it into a product. Moreover, you will go through the best practices in Truffle,so as to increase your proficiency in building Dapps with Truffle. By the end of the book, you will be able to write smart contracts and build decentralized applications with Truffle on Ethereum blockchains.
Table of Contents (9 chapters)

Testing Your Dapp

This chapter will introduce you to the importance of thoroughly testing your smart contracts, as well as various techniques and approaches for successfully testing a Truffle application. Specifically, this chapter will cover how to write comprehensive unit tests in Solidity and JavaScript, as well as the correct method for testing modifiers and reverts. Moreover, this chapter will illustrate how to test for events being thrown in your Solidity contract too. You will also learn about fundamental concepts, such as transaction objects and parameters, when working with truffle-contract and web3.

In particular, you will learn how to do the following:

  • Write comprehensive unit tests in Solidity
  • Write comprehensive unit tests in JavaScript
  • Test Solidity events

Unit tests are a great way to test whether your contract works as expected, rather than learning the hard...