Testing considerations for the trade network
So far in this chapter, we have focused on setting up the various artifacts to protect our code base. However, we have not covered one key element of a pipeline: providing a proper set of tests to ensure the resiliency of our solution. In this section, we will look into some of the key aspects of the testing that went into the trade network.
We will limit our focus to the trade smart contract and the exporter rest gateway, which are written in TypeScript/JavaScript. However, these concepts extend to the Java components of the solution.
Unit testing
If the smart contracts define the rules of the network, then surely the unit tests are the guardians of those rules. Well-written unit tests effectively coerce source code into delivering the business intent. The challenge is in developing quality tests that properly validate the behavior of the system while being easy to maintain and resilient to change.
We say resilient to changes...