Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[e2e] Add new e2e_driver for handling response data and performance watcher #2906

Merged
merged 6 commits into from
Aug 5, 2020

Conversation

CareF
Copy link
Contributor

@CareF CareF commented Aug 3, 2020

Description

These are utilities for implementing e2e-based performance test. e.g.flutter/flutter#61509
These codes will be shared among most of such test cases.

Related Issues

flutter/flutter#58789

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@CareF CareF requested a review from liyuqian August 3, 2020 23:56
@CareF CareF requested a review from digiter as a code owner August 3, 2020 23:56
@CareF
Copy link
Contributor Author

CareF commented Aug 4, 2020

@liyuqian Our previous attempts to reuse kDebugWarning is causing issue: this is still in flutter/flutter master branch and the flutter SDK version for e2e need to wait until that PR lands to a release version.

@CareF
Copy link
Contributor Author

CareF commented Aug 4, 2020

@AlbertWang0116

@digiter digiter requested a review from dnfield August 4, 2020 21:07
binding.removeTimingsCallback(watcher);
// TODO(CareF): determine if it's running on firebase and report metric online
final FrameTimingSummarizer frameTimes = FrameTimingSummarizer(frameTimings);
binding.reportData = <String, dynamic>{'performance': frameTimes.summary};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is binding.reportData eventually picked up in driver response?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My original version in e2e_driver.dart particularly picked the performance value to write to file but I realized that e2e_driver.dart is probably used in a broader context, e.g. this reportData feature was introduced partly as an infra preparation for getting timeline and reporting it to the host in an e2e test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks for the explanation!

Copy link
Contributor

@AlbertWang0116 AlbertWang0116 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

binding.removeTimingsCallback(watcher);
// TODO(CareF): determine if it's running on firebase and report metric online
final FrameTimingSummarizer frameTimes = FrameTimingSummarizer(frameTimings);
binding.reportData = <String, dynamic>{'performance': frameTimes.summary};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks for the explanation!

/// ```
Future<void> e2eDriver({
Duration timeout = const Duration(minutes: 1),
ResponseDataCallback responseDataCallback = writeResponseData,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default to write response.data into e2e_perf_summary.json seems a little strange as it doesn't necessarily have perf summary data. Shall we default to not write any file, and provide a perfResponseCallback that writes response.data['performance'] into e2e_perf_summary.json? That seems a little more helpful in updating your current code in https://github.com/flutter/flutter/pull/61509/files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably should change the file name to some more general ones. Getting performance entry is just one more line like in https://github.com/flutter/flutter/pull/62064/files#diff-73e66281b14c792afcdcd20acb9edd92R11 while I'm imagining this e2eDriver will be used in a broader context, e.g. reporting timeline as in flutter/flutter#58789 , so I'm trying to make this function useful independent of the performance test context while still being useful in my project.

Copy link
Contributor Author

@CareF CareF Aug 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for by default not writing anything, writeResponseData will look like an unused method. Maybe I should add an example to e2e as for demo the usage of this PR. If we decide to go that direction I'll open a new PR after this lands for that.

@CareF CareF requested a review from liyuqian August 5, 2020 15:17
Copy link

@liyuqian liyuqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CareF CareF merged commit 9d77f5d into flutter:master Aug 5, 2020
@CareF CareF deleted the end_perf branch August 5, 2020 19:57
jarrodcolburn pushed a commit to jarrodcolburn/plugins that referenced this pull request Aug 20, 2020
@CareF CareF mentioned this pull request Oct 6, 2020
13 tasks
jorgefspereira pushed a commit to jorgefspereira/plugins_flutter that referenced this pull request Oct 10, 2020
FlutterSu pushed a commit to FlutterSu/flutter-plugins that referenced this pull request Nov 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants