How to unit-test Mercari Hallo Flutter app
Article Summary
Mercari's Hallo team shares how they built a robust Flutter testing strategy that actually speeds up development instead of slowing it down.
Heejoon, a software engineer on Mercari's Work Mobile team, walks through their complete unit testing approach for the Hallo Flutter app. The article covers everything from basic logic tests to handling time-dependent code, widget testing with golden files, and automated code coverage in CI/CD.
Key Takeaways
- Use the clock package to freeze time for deterministic tests
- Custom testThemedWidgets runs tests across light/dark themes and multiple screen sizes
- Automated differential coverage reports show exactly what new code lacks tests
- Custom linters prevent DateTime.now() usage to avoid flaky time-based tests
- Golden file testing catches visual regressions across theme and size combinations
Critical Insight
Mercari Hallo's testing infrastructure combines custom wrappers, automated coverage analysis, and smart tooling to maintain high quality while keeping development velocity fast.