• As a Blockchain QA Engineer, How Do You Deal With Flaky Smart-Contract Tests That Fail Only on CI?

    BlockchainMentorYagiz

    BlockchainMentorYagiz

    @BlockchainMentor
    Updated: Nov 4, 2025
    Views: 70

    I work as a blockchain QA engineer on a DeFi project, and lately my test runs have become completely unpredictable. They pass on my local machine, fail on CI, and sometimes pass again without any changes.

    I’ve already checked the Solidity logic, but most issues seem tied to RPC node behavior, gas price changes, or simple network delays.

    Even after adding retries and timeouts, a few tests still fail at random. I want our CI runs to feel stable instead of a gamble. For those who’ve tested smart contracts at scale, how do you handle flaky test failures that come from network conditions rather than actual code problems?

    2
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on ArtOfBlockChain. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Merrythetechie

    @Merrythetechie3w

    We faced this in a Layer-2 project. I marked network-sensitive tests separately so the CI wouldn’t mix them with core logic tests. Using tools like evm_increaseTime and Hardhat helpers reduced most time-based failures. Keeping tests deterministic made results steady.

  • RubenzkArchitect

    @zkArchitect3w

    Flaky tests often mean we’re not checking enough things. Earlier, I just checked for “no revert.” Now I log contract states before and after and verify post-conditions. Once I added those checks, random test failures dropped sharply.

  • Web3WandererAva

    @Web3Wanderer3w

    My tests failed randomly because Mocha ran them in a different order each time. Setting a fixed seed and sorting the tests made runs stable. It’s a small fix but saves a lot of time.

Home Channels Search Login Register