Unit test kiểm tra function/class độc lập: test('Math', () { expect(2+2, equals(4)); }).
- Widget test kiểm tra widget mà không render thực:
testWidgets('Button', (tester) { await tester.tap(find.byType(Button)); }). - Integration test kiểm tra toàn bộ app trên thiết bị/emulator thật.
- Unit test nhanh và đáng tin cậy.
- Widget test phát hiện bug UI.
- Integration test phát hiện vấn đề thực tế.
- Dùng cả ba theo mô hình kim tự tháp.
Unit tests test functions/classes in isolation.
- Widget tests test widgets without rendering to screen.
- Integration tests test the entire app on a real device/emulator.
- Use all three in a balanced test pyramid — unit tests are fastest and most reliable, integration tests catch real-world issues.