Testing Interview Questions (Flutter)
6 Testing questions from the Flutter track. Read each short answer here, then open a question for the full explanation, examples, common mistakes, and sources.
- Junior
What distinguishes a unit test in a Flutter project?
A unit test exercises a function or class in isolation quickly, and is suited to domain rules and conversions without running the Flutter engine or the UI.
Read the full explanation - Junior
When do you use a widget test in Flutter?
A widget test runs part of the widget tree and measures visible behavior and interaction with fake dependencies at reasonable speed.
Read the full explanation - Mid-level
What is the role of an integration test and when is it worth its cost?
An integration test verifies a complete flow across the app and platform such as login or payment, but it is slower and more dependent on the environment.
Read the full explanation - Mid-level
What is the practical difference between a fake, a mock, and a stub in Flutter tests?
A test double replaces a dependency; a fake is a simple working implementation, a stub returns fixed answers, and a mock verifies expected interactions.
Read the full explanation - Senior
How do you make Flutter tests reliable and not flaky?
Isolate time, randomness, and the network, wait for a clear condition using test tools instead of sleep, and clean up resources and test data after each case.
Read the full explanation - Mid-level
When do you use a golden test in Flutter?
Use it to compare rendering against a reference image and detect intentional or unintentional visual changes, while fixing the environment factors that affect the image.
Read the full explanation