Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
3b067049
Unverified
Commit
3b067049
authored
Apr 28, 2020
by
Katarina Sheremet
Committed by
GitHub
Apr 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support tags in testWidgets (#55141)
parent
7b1d2421
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
0 deletions
+49
-0
AUTHORS
AUTHORS
+1
-0
filtering_tag_widget_test.dart
...tomated_tests/flutter_test/filtering_tag_widget_test.dart
+14
-0
widget_tester.dart
packages/flutter_test/lib/src/widget_tester.dart
+5
-0
test_test.dart
...lutter_tools/test/commands.shard/permeable/test_test.dart
+29
-0
No files found.
AUTHORS
View file @
3b067049
...
...
@@ -53,3 +53,4 @@ Efthymios Sarpmpanis <e.sarbanis@gmail.com>
Cédric Wyss <cedi.wyss@gmail.com>
Michel Feinstein <michel@feinstein.com.br>
Michael Lee <ckmichael8@gmail.com>
Katarina Sheremet <katarina@sheremet.ch>
dev/automated_tests/flutter_test/filtering_tag_widget_test.dart
0 → 100644
View file @
3b067049
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'included'
,
(
WidgetTester
tester
)
async
{
expect
(
2
+
2
,
4
);
},
tags:
<
String
>[
'include-tag'
]);
testWidgets
(
'excluded'
,
(
WidgetTester
tester
)
async
{
throw
'this test should have been filtered out'
;
},
tags:
<
String
>[
'exclude-tag'
]);
}
packages/flutter_test/lib/src/widget_tester.dart
View file @
3b067049
...
...
@@ -89,6 +89,9 @@ typedef WidgetTesterCallback = Future<void> Function(WidgetTester widgetTester);
/// each value of the [TestVariant.values]. If [variant] is not set, the test
/// will be run once using the base test environment.
///
/// If the [tags] are passed, they declare user-defined tags that are implemented by
/// the `test` package.
///
/// See also:
///
/// * [AutomatedTestWidgetsFlutterBinding.addTime] to learn more about
...
...
@@ -112,6 +115,7 @@ void testWidgets(
Duration
initialTimeout
,
bool
semanticsEnabled
=
true
,
TestVariant
<
Object
>
variant
=
const
DefaultTestVariant
(),
dynamic
tags
,
})
{
assert
(
variant
!=
null
);
assert
(
variant
.
values
.
isNotEmpty
,
'There must be at least on value to test in the testing variant'
);
...
...
@@ -150,6 +154,7 @@ void testWidgets(
},
skip:
skip
,
timeout:
timeout
??
binding
.
defaultTestTimeout
,
tags:
tags
,
);
}
}
...
...
packages/flutter_tools/test/commands.shard/permeable/test_test.dart
View file @
3b067049
...
...
@@ -125,6 +125,35 @@ void main() {
expect
(
result
.
exitCode
,
1
);
});
testUsingContext
(
'flutter test should run a widgetTest with a given tag'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
final
ProcessResult
result
=
await
_runFlutterTest
(
'filtering_tag_widget'
,
automatedTestsDirectory
,
flutterTestDirectory
,
extraArguments:
const
<
String
>[
'--tags'
,
'include-tag'
]);
if
(!(
result
.
stdout
as
String
).
contains
(
'+1: All tests passed'
))
{
fail
(
'unexpected output from test:
\n\n
${result.stdout}
\n
-- end stdout --
\n\n
'
);
}
expect
(
result
.
exitCode
,
0
);
});
testUsingContext
(
'flutter test should not run a widgetTest with excluded tag'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
final
ProcessResult
result
=
await
_runFlutterTest
(
'filtering_tag_widget'
,
automatedTestsDirectory
,
flutterTestDirectory
,
extraArguments:
const
<
String
>[
'--exclude-tags'
,
'exclude-tag'
]);
if
(!(
result
.
stdout
as
String
).
contains
(
'+1: All tests passed'
))
{
fail
(
'unexpected output from test:
\n\n
${result.stdout}
\n
-- end stdout --
\n\n
'
);
}
expect
(
result
.
exitCode
,
0
);
});
testUsingContext
(
'flutter test should run all widgetTest when tags are unspecified'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
final
ProcessResult
result
=
await
_runFlutterTest
(
'filtering_tag_widget'
,
automatedTestsDirectory
,
flutterTestDirectory
);
if
(!(
result
.
stdout
as
String
).
contains
(
'+1 -1: Some tests failed'
))
{
fail
(
'unexpected output from test:
\n\n
${result.stdout}
\n
-- end stdout --
\n\n
'
);
}
expect
(
result
.
exitCode
,
1
);
});
testUsingContext
(
'flutter test should test runs to completion'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
final
ProcessResult
result
=
await
_runFlutterTest
(
'trivial'
,
automatedTestsDirectory
,
flutterTestDirectory
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment