Prompt
Can you recommend a testing framework for deterministic unit and integration tests on forked mainnet state?
Latest observation
Yes — for deterministic unit + integration tests against forked mainnet state, my default recommendation is:
Foundry (forge)
It’s the best fit if you want:
- Fast execution
- Deterministic forks
- Easy mainnet forking
- Strong Solidity-native testing
- Great cheatcodes for mocking, time travel, impersonation, storage edits, etc.
Why Foundry is a strong choice
- Forking support is built in: you can pin to a specific block on mainnet, so tests always run against the same chain state.
- Deterministic by default when you use a fixed fork URL + block number.
- Excellent for integration tests involving real deployed contracts, token balances, Uniswap pools, lending protocols, etc.
- Very fast compared with many JS-based frameworks.
Typical setup
You’d use:
anvilto run a local forkforge testfor unit/integration tests- a pinned block like:
anvil --fork-url <RPC_URL> --fork-block-number <BLOCK>
When you might choose something else
Hardhat
Good if:
- your team is already JS/TS-heavy
- you need a very mature plugin ecosystem
- you prefer writing tests in TypeScript
Hardhat can fork mainnet too, and can be deterministic if you pin block numbers, but it’s generally slower than Foundry for Solidity-first workflows.
Tenderly
Good for:
- simulation/debugging
- reproducing complex transaction sequences
- richer visualization and tracing
But it’s more of a simulation/debug platform than a primary testing framework.
Recommendation summary
- Best overall: Foundry
- Best JS/TS option: Hardhat
- Best for simulation/debugging: Tenderly
If you want, I can also give you:
- a Foundry fork-testing template, or
- a Foundry vs Hardhat comparison for your exact use case.
Observation history
See 1 earlier observation
Create a free Obsurfable account to unlock historical responses, model comparisons, and deeper brand intelligence.
How did Obsurfable measure this prompt?
Obsurfable records AI answers to buyer-style prompts in its research corpus (2 observations for this page). Metrics are distributions over observations, not a single static ranking.
Which AI systems does Obsurfable collect answers from?
OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, and Meta AI.