Add retry flag to flutter_test (#125851)

Closes https://github.com/flutter/flutter/issues/125920

I will add tests, polish code, etc, if this change looks generally OK!
This commit is contained in:
fzyzcjy
2023-06-02 06:25:52 +08:00
committed by GitHub
parent 7f1f765521
commit ffe94a2267
3 changed files with 22 additions and 2 deletions

View File

@@ -51,6 +51,24 @@ void main() {
});
});
group('group retry flag allows test to run multiple times', () {
bool retried = false;
group('the group with retry flag', () {
testWidgets('the test inside it', (WidgetTester tester) async {
addTearDown(() => retried = true);
expect(retried, isTrue);
});
}, retry: 1);
});
group('testWidget retry flag allows test to run multiple times', () {
bool retried = false;
testWidgets('the test with retry flag', (WidgetTester tester) async {
addTearDown(() => retried = true);
expect(retried, isTrue);
}, retry: 1);
});
group('respects the group skip flag', () {
testWidgets('should be skipped', (WidgetTester tester) async {
expect(false, true);