Thuta Learning
Flutter
AdvancedMobile Developmentbeginner

Unit, Widget & Integration Testing

Flutterသင်ခန်းစာ 27

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Unit, Widget & Integration Testing ရဲ့ widget, state နဲ့ lifecycle behavior ကိုရှင်းပြနိုင်ရန်
  • Responsive, failure နဲ့ interaction cases စမ်းနိုင်ရန်
  • Accessible, testable, performant Flutter code ရေးနိုင်ရန်

Unit, Widget & Integration Testing ကို feature slices ဖြင့်တည်ဆောက်ပြီး unit, widget နဲ့ integration tests ခွဲစစ်ပါ။ Debug/profile/release modes, frame time, rebuild count, accessibility နဲ့ deployment configuration ကို measurable acceptance criteria ထားပါ။

ပိုပြီးနားလည်ထားရမယ့် အချက်

Unit, Widget & Integration Testing ကို feature slices ဖြင့်တည်ဆောက်ပြီး unit, widget နဲ့ integration tests ခွဲစစ်ပါ။ Debug/profile/release modes, frame time, rebuild count, accessibility နဲ့ deployment configuration ကို measurable acceptance criteria ထားပါ။

လက်တွေ့မှာ ဘယ်လိုအသုံးချမလဲ

Unit, Widget & Integration Testing example ကို small/large screen, text scaling, empty/loading/error, rapid interaction, navigation restore နဲ့ disposal cases ဖြင့် run/test လုပ်ပါ။ flutter analyze, widget tests နဲ့ profile mode ကိုလိုအပ်သလိုသုံးပါ။

ဒီသင်ခန်းစာပြီးရင်

dart
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  testWidgets('shows the title', (tester) async {
    await tester.pumpWidget(const MaterialApp(home: Text('Tasks')));
    expect(find.text('Tasks'), findsOneWidget);
  });
}
You should see
All tests passed!

ကိုယ်တိုင်စမ်းကြည့်ရန်

Unit, Widget & Integration Testing example ကို small/large screen, text scaling, empty/loading/error, rapid interaction, navigation restore နဲ့ disposal cases ဖြင့် run/test လုပ်ပါ။ flutter analyze, widget tests နဲ့ profile mode ကိုလိုအပ်သလိုသုံးပါ။

Lifecycle/Performance သတိပေးချက်

Screen တစ်မျိုးတွင် sample output မှန်ရုံဖြင့် rebuild, overflow, accessibility, async နဲ့ lifecycle paths အားလုံးမှန်ပြီဟုယူဆခြင်း။

Introduction to widget testingFlutter

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • Screen တစ်မျိုးတွင် sample output မှန်ရုံဖြင့် rebuild, overflow, accessibility, async နဲ့ lifecycle paths အားလုံးမှန်ပြီဟုယူဆခြင်း။
  • build() ထဲ expensive work လုပ်ခြင်း၊ controller/subscription မပိတ်ခြင်း သို့ setState ကိုကျယ်သော subtree ပေါ်ခေါ်ခြင်း။

လက်တွေ့လေ့ကျင့်ခန်း

Unit, Widget & Integration Testing example ကို small/large screen, text scaling, empty/loading/error, rapid interaction, navigation restore နဲ့ disposal cases ဖြင့် run/test လုပ်ပါ။ flutter analyze, widget tests နဲ့ profile mode ကိုလိုအပ်သလိုသုံးပါ။

You'll know it worked when: All tests passed!