@@ -100,6 +100,14 @@ typedef WidgetTesterCallback = Future<void> Function(WidgetTester widgetTester);
100100/// each value of the [TestVariant.values] . If [variant] is not set, the test
101101/// will be run once using the base test environment.
102102///
103+ /// If either [exclude] or [skip] is `true` , then the test will be skipped. The
104+ /// difference is that [skip] is a temporary way to disable a problematic test
105+ /// while a fix is being developed. It should have a comment after it with a
106+ /// link to a tracking issue for the work on re-enabling the test.
107+ ///
108+ /// [exclude] is used to indicate that the test is not designed to run under
109+ /// the condition given and should always be skipped when it is `true` .
110+ ///
103111/// If the [tags] are passed, they declare user-defined tags that are implemented by
104112/// the `test` package.
105113///
@@ -117,11 +125,26 @@ typedef WidgetTesterCallback = Future<void> Function(WidgetTester widgetTester);
117125/// expect(find.text('Success'), findsOneWidget);
118126/// });
119127/// ```
128+ ///
129+ /// ### Excluded test
130+ /// ```dart
131+ /// testWidgets('Some test that will never make sense for the web', (WidgetTester tester) async {
132+ /// // test code
133+ /// }, exclude: isBrowser);
134+ /// ```
135+ ///
136+ /// ### Skipped test
137+ /// ```dart
138+ /// testWidgets('Some flaky test', (WidgetTester tester) async {
139+ /// // test code
140+ /// }, skip: true); // https://github.com/flutter/flutter/issues/12345
141+ /// ```
120142@isTest
121143void testWidgets (
122144 String description,
123145 WidgetTesterCallback callback, {
124- bool ? skip,
146+ bool skip = false ,
147+ bool exclude = false ,
125148 test_package.Timeout ? timeout,
126149 Duration ? initialTimeout,
127150 bool semanticsEnabled = true ,
@@ -169,7 +192,7 @@ void testWidgets(
169192 timeout: initialTimeout,
170193 );
171194 },
172- skip: skip,
195+ skip: (exclude || skip) ? true : null ,
173196 timeout: timeout ?? binding.defaultTestTimeout,
174197 tags: tags,
175198 );
0 commit comments