A web3 team with no QA should test in this order: contract logic first, then the money paths through the frontend, then the backend and indexer, then infrastructure. Automate the checks that run on every pull request, keep exploratory work manual, and treat an audit as a later layer on top, not a replacement for tests.
The rest of this post is the reasoning, a table you can copy, and a 30-day plan. It is written for a team of around ten engineers where nobody owns quality. I’m describing a general approach here, not a specific client project.
Where web3 teams usually start
Most teams begin with the contract unit tests that came with the scaffold, plus a manual click-through before each release. Then an audit is booked, and the audit report becomes the de facto test plan.
That order has two problems. Unit tests for the happy path pass while the real bugs sit in state transitions and integrations. And an audit is a point-in-time review of one commit, so every change after it is untested by anyone. The web2 vs web3 testing differences post covers why: deployed contracts are hard to patch, and the frontend talks to a chain that never resets.
The fix is cheap ordering. Test where a bug costs the most first, and where it is cheapest to automate.
The layers and where the risk sits
A web3 product has four layers. They fail in different ways and need different tests.
| Layer | Main risk | First test to write | Tool | Owner |
|---|---|---|---|---|
| Smart contracts | Lost or locked funds, broken access control | Revert and event tests for every external function | Foundry or Hardhat | Contract developers |
| Frontend (dapp) | User signs the wrong transaction, UI shows wrong amounts | One E2E test of the main money path against a local chain | Playwright + Anvil | Frontend developers, with QA review |
| Backend and indexer | Stale or wrong data shown to users | Contract test: events in, expected rows out | Your API test runner | Backend developers |
| Infrastructure | RPC outage, rate limits, bad deploy | Post-deploy smoke test against the live network | A small script in CI | Whoever owns deploys |
Contracts come first because a bug there is the only kind you cannot hotfix. The frontend is second because it is where users actually lose money to a wrong approval or wrong decimals. Backend and infrastructure fail more loudly and are easier to recover from.
What to automate first
Automate a test when it is deterministic, fast, and protects something you change often. For a team starting from zero, that gives this order.
- Contract unit tests for every external function. Cover reverts, events, access control and arithmetic edges. See Solidity unit test patterns for the structure.
- A fuzz test for each function that moves value. In Foundry this is a function with arguments, so the extra cost is small. How to test smart contracts walks through unit, fuzz, invariant and fork tests in order.
- A CI job that runs both on every pull request. A test that runs only on a developer’s laptop does not count as a test.
- One E2E test for the money path. If your product is a swap, it is connect wallet, approve, swap, see the new balance. One test, not twenty. See integration testing web3 smart contracts and frontend.
- A smoke test after each deploy. It reads a few values from the live contracts and loads the app. It is the cheapest protection against a wrong address or wrong chain ID in the config.
Choosing the contract framework is a smaller decision than people make it. I compared them in Foundry vs Hardhat for testing. Pick one in an afternoon.
What to leave manual
Not everything deserves automation in month one.
- Exploratory testing of new features. A person with a checklist and a testnet wallet finds problems no script anticipates.
- Wallet UX across extensions and mobile wallets. Automated wallet tests are brittle. Check the real wallets by hand before a release.
- Visual polish. Look at it. Add screenshot tests later if layout bugs recur.
- Anything you will only run once. A migration script that runs once needs a dry run on a fork and a reviewer, not a permanent test.
Manual does not mean undocumented. Write the checklist in the repo and run the same one each release. A checklist you run is a test suite that has not been automated yet.
A 30-day plan
This plan assumes a small hypothetical protocol: a vault contract, an API that reads its events, and a React frontend. Adjust the details to your product. The sequence is what matters.
Week 1: Inventory and contract basics
- List every external function and every place the frontend or backend reads from a contract. Mark which handle funds.
- Pick the framework. Set up the test command so
pnpm testorforge testruns everything. - Write reverts, events and access-control tests for the funds-handling functions first.
Week 2: Fuzz and CI
- Add a fuzz test for each function that moves value, with bounds on the inputs.
- Run tests on every pull request in GitHub Actions. Make the check required for merge.
- Add a gas snapshot or report so a change that doubles gas shows up in review.
Week 3: The money path
- Spin up a local chain, deploy the contracts in a setup step, and write one E2E test of the main user flow.
- Add a contract test for the backend: feed it sample events, assert on the stored data.
- Write the manual release checklist and run it once.
Week 4: Deploy safety and review
- Add a post-deploy smoke test that checks addresses, chain ID and one read call.
- Run the whole suite from a clean checkout and fix anything that depends on your machine.
- Review what the tests do not cover and decide what is next: invariants, a fork test, or an audit prep pass.
At day 30 you have contracts covered, a gate in CI, one E2E test and a smoke test. That is a far better base than most teams have the week before an audit.
What this looks like in CI
A starting workflow for a Foundry-based contract repo:
name: ci
on:
pull_request:
push:
branches: [main]
jobs:
contracts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: foundry-rs/foundry-toolchain@v1
- run: forge build --sizes
- run: forge test -vvv
- run: forge snapshot --check
forge snapshot --check fails the job if gas usage changed from the committed .gas-snapshot, which turns gas regressions into a visible diff. Commit the snapshot file after reviewing changes. For a Hardhat project, replace the last three steps with pnpm install --frozen-lockfile and pnpm hardhat test.
How to measure that it works
Skip vanity metrics like coverage percentage on their own. A suite with 100% line coverage can still miss a broken invariant. Watch these instead:
- Time from pull request to green or red. If it grows past ten minutes, people start merging around it.
- Bugs found after merge that a test could have caught. Each one gets a test written before the fix. That is the main feedback loop.
- Flaky test count. Zero is the target. A suite that fails at random is ignored. The causes and fixes for flaky E2E tests apply to dapp tests too.
- Functions with value movement and no fuzz test. Keep that list short and visible.
I’d treat coverage as a way to find untested code, not as a goal.
Cost and who does it
The cost depends on who writes the tests and how much of an audit you buy. I put ranges and the reasoning in how much web3 testing really costs, so I won’t repeat numbers here.
On who does the work, there are three realistic options for a team of ten. Developers write the contract and unit tests themselves, because they know the code. Someone senior owns the strategy and the CI gate. And one person writes the E2E and integration layer, which is where developers tend to be least interested and least available. That last role is what a part-time test engineer covers well.
A note on audits
An audit does not replace this work. Auditors find vulnerabilities in a snapshot of your code. Your tests protect every commit after that snapshot, and a clean test suite with documented invariants makes the audit itself shorter and more useful. Prepare the suite first, then book the audit.
Where I can help
If nobody on your team owns quality and you’d like a plan like this applied to your product, I do this as a part-time test engineer: the strategy and the tests. Details are on the hire me page. If you’d rather run the plan yourself, start with week 1 and the function inventory today.
FAQ
What should a web3 startup test first? Test the smart contract functions that move funds, covering reverts, events and access control. After that, add a single end-to-end test for the main user flow, because that is where users actually lose money.
Do we need a QA engineer if we already pay for an audit? An audit reviews one commit, so changes after it are unchecked. You need tests that run on every change, and someone responsible for them, whether that is a developer, a lead or a part-time test engineer.
How much test automation is enough for a web3 MVP? Unit and fuzz tests on every value-moving contract function, a required CI check, one E2E test of the main flow and a post-deploy smoke test. That set is realistic in about a month for a small team.
Foundry or Hardhat for a new project? Foundry suits contract-heavy teams that write Solidity tests, and Hardhat suits teams that share TypeScript with the frontend. The comparison post has a table and measured run times.