10 Testing smart contracts

 

This chapter covers

  • Seeing the importance of testing smart contracts

  • Writing test scripts in JavaScript

  • Using Truffle frameworks to support smart contract testing

  • Interpreting outputs from running test scripts

  • Developing test scripts for the counter, ballot, and blind auction smart contracts

10.1 Importance of testing smart contracts

10.1.1 Types of testing

10.1.2 Language choice for test programs

10.2 Testing counter smart contract

10.2.1 Writing counter test script

10.2.2 Positive and negative tests

10.2.3 Running the test script

10.3 Testing ballot smart contract

10.3.1 Writing the ballot test script

10.3.2 Executing the ballot test script

10.3.3 Describe() and it() test functions

10.4 Recap writing of test script

10.5 The blind auction test script

10.5.1 Analysis of describe() and it() code

10.5.2 Executing the blind auction test script

10.5.3 Full auction run

10.6 Retrospective

10.7 Best practices

10.8 Summary

sitemap