Running tests in testnet

I tried to run OpenZeppelin tests in ropsten network and I noticed they’re not meant to be run in environments other than development, so of course they failed.

I was wondering, is there a reason to run tests in testnets? Is there a reason not to?

Hey there @abbypescow, welcome to the forum!

Indeed, multiple tests require changing the time of the blockchain (usually moving it forward to e.g. simulate a TimedCrowdsale opening and closing). I would be possible to run these in e.g. Ropsten with some dependency injection, and mocking block.timestamp and friends, but those tests would take very long to run, require tons of Ropsten Ether, while providing dubious benefit.

A more interesting and feasable idea is running them against a Geth or Parity node, instead of ganache, which would move us a step closer to a production environment (since there are some small discrepancies between ganache and real nodes). We have an open issue for this: If I recall correctly there were worries that running tests this way would take longer, but we could easily schedule e.g. nightly runs with this setup, as opposed to having it be the standard way of doing things.

1 Like