Testing with package:test ကို library boundaries, domain logic, I/O နဲ့ tests ခွဲထားသော vertical slices ဖြင့်တည်ဆောက်ပါ။ Normal, null, empty, invalid, async-error နဲ့ cancellation cases ကို repeatable tests ဖြင့်စစ်ပါ။
ပိုပြီးနားလည်ထားရမယ့် အချက်
Testing with package:test ကို library boundaries, domain logic, I/O နဲ့ tests ခွဲထားသော vertical slices ဖြင့်တည်ဆောက်ပါ။ Normal, null, empty, invalid, async-error နဲ့ cancellation cases ကို repeatable tests ဖြင့်စစ်ပါ။
လက်တွေ့မှာ ဘယ်လိုအသုံးချမလဲ
Testing with package:test example ကို null, empty, boundary, invalid, async-error နဲ့ cancellation cases ဖြင့် run/test လုပ်ပါ။ dart format, dart analyze နဲ့ dart test ကိုသုံးပြီး Future/Stream subscription နဲ့ isolate boundary ကိုလိုအပ်သလိုစစ်ပါ။
ဒီသင်ခန်းစာပြီးရင်
import 'package:test/test.dart';
int total(Iterable<int> values) => values.fold(0, (a, b) => a + b);
void main() {
group('total', () {
test('handles empty and populated values', () {
expect(total([]), 0);
expect(total([1, 2, 3]), 6);
});
});
}All tests passed!ကိုယ်တိုင်စမ်းကြည့်ရန်
Testing with package:test example ကို null, empty, boundary, invalid, async-error နဲ့ cancellation cases ဖြင့် run/test လုပ်ပါ။ dart format, dart analyze နဲ့ dart test ကိုသုံးပြီး Future/Stream subscription နဲ့ isolate boundary ကိုလိုအပ်သလိုစစ်ပါ။
Null/Async သတိပေးချက်
Sample output တစ်ခုမှန်ရုံဖြင့် null, promotion, Future, Stream နဲ့ isolate paths အားလုံးမှန်ပြီဟုယူဆခြင်း။
Dart testing — Dart