What's the most effective way to test Upgradable Contracts?

Writing Upgradable contracts include different sets of procedures than the ususal.

Therefore, I was curious to know what’s the most effective way of testing upgradables contracts.

Would love to know if there are some specific libraries that I can use for this purpose.

1 Like

Hi @zaryab2000,

Great question. Thanks for posting here. :pray:

I recommend creating unit tests (aim for 100% coverage) for your implementation contracts and then a selection of higher level tests to cover the use of the proxy. See the Learn guides for more details: https://docs.openzeppelin.com/learn/upgrading-smart-contracts#testing

I have an example of unit tests for the implementation contract and some higher level tests via the proxy in the step by step tutorials:

You can use Truffle or Hardhat (formerly Buidler), or OpenZeppelin Test Environment.
If you are using web3 then I suggest looking at OpenZeppelin Test Helpers (https://docs.openzeppelin.com/test-helpers/0.5/).

Please note we will be creating an Upgrades Plugin for Hardhat soon, until then you can use Buidler or Truffle.