Automated testing is the cornerstone of modern software engineering. It allows developers to quickly verify if a piece of code works according to specification. This again allows for rapid iteration on both the design and implementation of a work. Mature programming languages come with a selection of test runners, assertion engines and mock libraries.
The Ethereum community made a good job of repurposing some of this tools. But until now we were missing an important piece of the testing puzzle. We were unable to easily create mocks of smart contracts. Which in turn made it almost impossible for us to write proper unit tests quickly. I’m happy to announce that with the release of Doppelganger we now have our first smart contract mocking solution.
To illustrate how Doppelganger can be used to help you test, let’s look at following smart contract:
In our tests we will be using Doppelganger to mock the ERC20 passed into the constructor.
Doppelganger was conceived as a submission for the #Cryptolife hackathon by Status, that took place October 26–29, 2018 in Prague. Where it received special recognition in the infrastructure track.
Follow us GitHub, and stay tuned as work on Doppelganger continues.