What is the most agile way to fully integration test smart contract code? I've seen people use shell, etc. Is there a golden standard somewhere?

  • I am not familiar with a golden standard, but are you going to be testing it inside a Nodejs application? If so I can provide an example of what I have done in the past.
    – Daniel
    Commented Jan 30, 2019 at 11:37
  • You may use truffle and ganache to build, deploy and test your code. There is also the possibility to measure the code coverage of your test. For my contracts I have 100% code coverage during tests as policy. Commented Sep 24, 2020 at 17:04

1 Answer 1


Here are two approaches which are the most versatile and which can help you cover all your test scenarios.

Make a testing dApp

Deploy your contract locally or to a network and then interrogate it using a variety of commands. You write these commands with Web3. Here is one example that interrogates events and contract calls.


This is a benchmark test, which surely is a full integration test. You have available the full power of JavaScript and Web3 RPC in this test setup. However, any stubs or interactions will need to be deployed and paid for with gas.

Do live testing

With this approach you can deploy stubs to mainnet with all your test fixtures. And you can orchestrate the entire integration between deployed contracts that you need for integration testing. I will demonstrate how you can do this without spending any gas.

  1. Write all of your testing code, including stub deployment and assertions.
  2. Wrap this in a constructor function of a contract
  3. Compile this contract to byte code
  4. Run ESTIMATEGAS on that byte code

This live testing technique is documented thoroughly at https://0xcert.org/news/live-testing-smart-contracts-with-estimategas-william-entriken-tadej-vengust

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.