How to unit-test Mercari Hallo Flutter app
Article Summary
Heejoon from Mercari's Work Mobile team reveals how they built a comprehensive unit testing strategy for their Flutter app. Their approach catches bugs early and actually speeds up development.
The Mercari Hallo team shares their production-tested approach to unit testing in Flutter, covering everything from simple logic tests to complex time-dependent scenarios. They've automated code coverage analysis in their CI/CD pipeline and built custom tooling to streamline widget testing across multiple themes and screen sizes.
Key Takeaways
- Uses clock package to freeze time in tests, making time-dependent logic deterministic
- Custom testThemedWidgets() runs tests across light/dark themes and multiple screen sizes
- Automated CI/CD pipeline generates differential coverage reports for every pull request
- Custom linter prevents DateTime.now() usage, enforcing clock.now() for testability
- Golden image testing with dynamic placeholders catches visual regressions automatically
Mercari Hallo's testing infrastructure combines custom wrappers, automated coverage analysis, and smart tooling to maintain high code quality while accelerating Flutter development.
Continue reading
This page summarizes “How to unit-test Mercari Hallo Flutter app” by Mercari, published Dec 24, 2024. All credit for the original work goes to the authors.