Assertions in Dart and Flutter tests: an ultimate cheat sheet
Tests are essential for ensuring any software quality. Whether you are creating unit, widget, or integration tests for Flutter applications, the end goal of any test is asserting that the reality matches the expectations. Here is an ultimate cheat sheet for assertions in Dart and Flutter tests with many details explained!
Each of the items in this cheat sheet is discussed in greater detail in this series:
- expect and matcher
- equality matchers
- type and error matchers
- collection matchers
- numeric and comparable matchers
- universal and custom matchers
- matcher operators
- asynchronous expect and matchers
- Flutter widget matchers
- accessibility matchers
- golden matchers
- mock invocations and parameters
Check the official website for the overall approach to testing Flutter apps.
All the code is available on GitHub or in the interactive Zapp.
Tune in for the Flutter Global Summit on February 7, 2023 to watch a video presentation of this cheat sheet. Attendance is free!
Originally published at Invertase blog. Check out their awesome Authors Program!
Hi! 👋🏻 I’m Anna, Google Developer Expert in Flutter from Ukraine 🇺🇦 Follow me on Twitter, GitHub, YouTube, Medium to get notifications about my latest work.
It’s early 2023, and we in Ukraine are still fighting against russians committing genocide on our lands. If you find this content useful and have a coin to spare, support us with your donations. Stand with Ukraine!