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
446673a6
Unverified
Commit
446673a6
authored
Jun 01, 2021
by
Jia Hao
Committed by
GitHub
Jun 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[integration_test] Fix early reporting of results (#83685)
parent
0bccce62
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
21 deletions
+45
-21
common.dart
packages/integration_test/lib/common.dart
+3
-0
integration_test.dart
packages/integration_test/lib/integration_test.dart
+2
-7
binding_fail_test.dart
packages/integration_test/test/binding_fail_test.dart
+8
-0
fail_test_script.dart
packages/integration_test/test/data/fail_test_script.dart
+3
-4
fail_then_pass_test_script.dart
...ntegration_test/test/data/fail_then_pass_test_script.dart
+23
-0
pass_test_script.dart
packages/integration_test/test/data/pass_test_script.dart
+3
-5
pass_then_fail_test_script.dart
...ntegration_test/test/data/pass_then_fail_test_script.dart
+3
-5
No files found.
packages/integration_test/lib/common.dart
View file @
446673a6
...
...
@@ -294,5 +294,8 @@ abstract class IntegrationTestResults {
Map
<
String
,
dynamic
>?
get
reportData
;
/// Whether all the test methods completed successfully.
///
/// Completes when the tests have finished. The boolean value will be true if
/// all tests have passed, and false otherwise.
Completer
<
bool
>
get
allTestsPassed
;
}
packages/integration_test/lib/integration_test.dart
View file @
446673a6
...
...
@@ -40,7 +40,7 @@ class IntegrationTestWidgetsFlutterBinding extends LiveTestWidgetsFlutterBinding
IntegrationTestWidgetsFlutterBinding
()
{
tearDownAll
(()
async
{
if
(!
_allTestsPassed
.
isCompleted
)
{
_allTestsPassed
.
complete
(
true
);
_allTestsPassed
.
complete
(
failureMethodsDetails
.
isEmpty
);
}
callbackManager
.
cleanup
();
...
...
@@ -83,9 +83,6 @@ https://flutter.dev/docs/testing/integration-tests#testing-on-firebase-test-lab
reportTestException
=
(
FlutterErrorDetails
details
,
String
testDescription
)
{
results
[
testDescription
]
=
Failure
(
testDescription
,
details
.
toString
());
if
(!
_allTestsPassed
.
isCompleted
)
{
_allTestsPassed
.
complete
(
false
);
}
oldTestExceptionReporter
(
details
,
testDescription
);
};
}
...
...
@@ -133,7 +130,7 @@ https://flutter.dev/docs/testing/integration-tests#testing-on-firebase-test-lab
final
Completer
<
bool
>
_allTestsPassed
=
Completer
<
bool
>();
@override
List
<
Failure
>
get
failureMethodsDetails
=>
_failures
;
List
<
Failure
>
get
failureMethodsDetails
=>
results
.
values
.
whereType
<
Failure
>().
toList
()
;
/// Similar to [WidgetsFlutterBinding.ensureInitialized].
///
...
...
@@ -157,8 +154,6 @@ https://flutter.dev/docs/testing/integration-tests#testing-on-firebase-test-lab
@visibleForTesting
Map
<
String
,
Object
>
results
=
<
String
,
Object
>{};
List
<
Failure
>
get
_failures
=>
results
.
values
.
whereType
<
Failure
>().
toList
();
/// The extra data for the reported result.
///
/// The values in `reportData` must be json-serializable objects or `null`.
...
...
packages/integration_test/test/binding_fail_test.dart
View file @
446673a6
...
...
@@ -42,6 +42,14 @@ Future<void> main() async {
expect
(
results
,
containsPair
(
'passing test'
,
equals
(
'success'
)));
expect
(
results
,
containsPair
(
'failing test'
,
contains
(
_failureExcerpt
)));
});
test
(
'when one test fails, then another passes'
,
()
async
{
final
Map
<
String
,
dynamic
>?
results
=
await
_runTest
(
path
.
join
(
'test'
,
'data'
,
'fail_then_pass_test_script.dart'
));
expect
(
results
,
hasLength
(
2
));
expect
(
results
,
containsPair
(
'failing test'
,
contains
(
_failureExcerpt
)));
expect
(
results
,
containsPair
(
'passing test'
,
equals
(
'success'
)));
});
});
}
...
...
packages/integration_test/test/data/fail_test_script.dart
View file @
446673a6
...
...
@@ -9,6 +9,9 @@ import 'package:integration_test/integration_test.dart';
Future
<
void
>
main
()
async
{
final
IntegrationTestWidgetsFlutterBinding
binding
=
IntegrationTestWidgetsFlutterBinding
.
ensureInitialized
()
as
IntegrationTestWidgetsFlutterBinding
;
binding
.
allTestsPassed
.
future
.
then
((
_
)
{
print
(
'IntegrationTestWidgetsFlutterBinding test results:
${jsonEncode(binding.results)}
'
);
});
testWidgets
(
'failing test 1'
,
(
WidgetTester
tester
)
async
{
expect
(
true
,
false
);
...
...
@@ -17,8 +20,4 @@ Future<void> main() async {
testWidgets
(
'failing test 2'
,
(
WidgetTester
tester
)
async
{
expect
(
true
,
false
);
});
tearDownAll
(()
{
print
(
'IntegrationTestWidgetsFlutterBinding test results:
${jsonEncode(binding.results)}
'
);
});
}
packages/integration_test/test/data/fail_then_pass_test_script.dart
0 → 100644
View file @
446673a6
// 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
'dart:convert'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:integration_test/integration_test.dart'
;
Future
<
void
>
main
()
async
{
final
IntegrationTestWidgetsFlutterBinding
binding
=
IntegrationTestWidgetsFlutterBinding
.
ensureInitialized
()
as
IntegrationTestWidgetsFlutterBinding
;
binding
.
allTestsPassed
.
future
.
then
((
_
)
{
print
(
'IntegrationTestWidgetsFlutterBinding test results:
${jsonEncode(binding.results)}
'
);
});
testWidgets
(
'failing test'
,
(
WidgetTester
tester
)
async
{
expect
(
true
,
false
);
});
testWidgets
(
'passing test'
,
(
WidgetTester
tester
)
async
{
expect
(
true
,
true
);
});
}
packages/integration_test/test/data/pass_test_script.dart
View file @
446673a6
...
...
@@ -9,6 +9,9 @@ import 'package:integration_test/integration_test.dart';
Future
<
void
>
main
()
async
{
final
IntegrationTestWidgetsFlutterBinding
binding
=
IntegrationTestWidgetsFlutterBinding
.
ensureInitialized
()
as
IntegrationTestWidgetsFlutterBinding
;
binding
.
allTestsPassed
.
future
.
then
((
_
)
{
print
(
'IntegrationTestWidgetsFlutterBinding test results:
${jsonEncode(binding.results)}
'
);
});
testWidgets
(
'passing test 1'
,
(
WidgetTester
tester
)
async
{
expect
(
true
,
true
);
...
...
@@ -17,9 +20,4 @@ Future<void> main() async {
testWidgets
(
'passing test 2'
,
(
WidgetTester
tester
)
async
{
expect
(
true
,
true
);
});
tearDownAll
(()
{
print
(
'IntegrationTestWidgetsFlutterBinding test results:
${jsonEncode(binding.results)}
'
);
});
}
packages/integration_test/test/data/pass_then_fail_test_script.dart
View file @
446673a6
...
...
@@ -9,6 +9,9 @@ import 'package:integration_test/integration_test.dart';
Future
<
void
>
main
()
async
{
final
IntegrationTestWidgetsFlutterBinding
binding
=
IntegrationTestWidgetsFlutterBinding
.
ensureInitialized
()
as
IntegrationTestWidgetsFlutterBinding
;
binding
.
allTestsPassed
.
future
.
then
((
_
)
{
print
(
'IntegrationTestWidgetsFlutterBinding test results:
${jsonEncode(binding.results)}
'
);
});
testWidgets
(
'passing test'
,
(
WidgetTester
tester
)
async
{
expect
(
true
,
true
);
...
...
@@ -17,9 +20,4 @@ Future<void> main() async {
testWidgets
(
'failing test'
,
(
WidgetTester
tester
)
async
{
expect
(
true
,
false
);
});
tearDownAll
(()
{
print
(
'IntegrationTestWidgetsFlutterBinding test results:
${jsonEncode(binding.results)}
'
);
});
}
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