Thank you for attending TruffleCon 2019!
Feel free to use this scheduler to customize your Truffle experience.
View topics, speakers, time and availability. You can also let us know how each session you attended went so we can make your experience even better! 
Back To Schedule
Saturday, August 3 • 4:50pm - 5:20pm
Mock-Contract: A Smart Contract Mocking Framework for Truffle Tests

Sign up or log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
When unit-testing complex software systems in object-oriented programming languages we commonly use mocks to isolate the logic of the “unit under test” (UUT) from the logic of its dependent components. In Smart Contract tests on the contrary, we tend to inject real dependencies or custom made derivatives (e.g. MintableERC20) in order to configure our UUT. This setup can be cumbersome, introduce dependencies between tests and resembles more an integration test than a unit test. In this talk, we present a mocking framework for solidity. We show in a case study how a complete testsuite for a smart contract with multiple dependencies (ERC20 token, dex, etc) is much simpler to write with said framework. We also discuss limitations of unit-tests in the context of smart contract development and how they should be combined with integration tests for even higher confidence in the system.

This session has an attached slide deck.

avatar for Felix Leupold

Felix Leupold

Software Engineer, Gnosis

Saturday August 3, 2019 4:50pm - 5:20pm PDT