You test getters and trivial functions. Testing that name() returns the name is worthless. Test edge cases, failure modes, and economic invariants — the things that lose money when they break.
You don't fuzz. forge test finds the bugs you thought of. Fuzzing finds the ones you didn't. If your contract does math, fuzz it. If it handles user input, fuzz it. If it moves value, definitely fuzz it.
You don't fork-test. If your contract calls Uniswap, Aave, or any external protocol, test against their real deployed contracts on a fork. Mocking them hides integration bugs that only appear with real state.
Тестирование смарт-контрактов с Foundry — модульные тесты, фазз-тестирование, форк-тестирование, инвариантное тестирование. Что тестировать, что не тестировать и в чем ошибаются дипломированные специалисты. Источник: austintgriffith/ethskills.