-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[pigeon] Initial integration test setup #2851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pigeon] Initial integration test setup #2851
Conversation
This sets up initial proof-of-concept integration tests using the new shared native test harness: - Integration tests on the Dart side for void->void and Everything->Everything calls. - macOS implementations in the test plugin on the native side. - A new test target in the test script to drive them via `flutter test`. - A minimal change to the example app so that `flutter run`-ing it will test that the void->void call is wired up. Since this simple initial test hit flutter/flutter#111083, which caused the test to fail, this includes a fix for that. Short-term future work (by me): - Add integration test native setup and script targets for the other generators. This includes one just to keep the initial review scope smaller. - Update flutter#2816 to include the integration test since it's still blocked until I can address the CI issues. Medium-term future work (not all by me): - Remove the legacy iOS e2e test scaffold that is currently disabled. - Add significantly more integration test coverage (likely including flutter/flutter#115168 to reduce redundant API setup), including Flutter API integration tests rather than just host API tests. Part of flutter/flutter#111505 Fixes flutter/flutter#111083
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
| class _MyAppState extends State<MyApp> { | ||
| // ignore: unused_field | ||
| final TestPlugin _testPlugin = TestPlugin(); | ||
| late AllVoidHostApi api; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| HostEverythingSetup.setUp(binaryMessenger: registrar.messenger, api: plugin) | ||
| } | ||
|
|
||
| public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you not pull this out? It's a bit confusing to have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot it was marked as @optional in the protocol; removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot it was marked as @optional in the protocol; removed.
| 'macos_swift_unittests': _TestInfo( | ||
| function: _runMacOSSwiftUnitTests, | ||
| description: 'Unit tests on generated Swift code on macOS.'), | ||
| 'macos_swift_integration_tests': _TestInfo( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are called e2e tests above, we should standardize the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My intent was to standardize on integration test (as that's what Flutter now calls those tests) in this file, and in the legacy shell script keep using e2e for now to avoid churn in a file that we want to eliminate anyway.
I've removed the no-op e2e iOS test from this file (it's only actually implemented in the shell script, and even there it's broken and will be removed later) to accelerate that process.
| class _MyAppState extends State<MyApp> { | ||
| // ignore: unused_field | ||
| final TestPlugin _testPlugin = TestPlugin(); | ||
| late AllVoidHostApi api; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't there be an EverythingApi too somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's in the actual integration test file (which I discovered I didn't git add 🤦🏻 ). The change to main.dart isn't actually necessary for this PR, I just think it's less confusing to have it do a trivial "is Pigeon doing something" sanity test, and show a Pigeon call, than for it to do nothing, so I added a single call. I don't plan to add anything else here in the future (unless at some point someone wants to build some kind of interesting manual test UI, but I can't see a good use case for manual tests for Pigeon if we have good integration tests.)
gaaclarke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
This sets up initial proof-of-concept integration tests using the new shared native test harness:
flutter test.flutter run-ing it will test that the void->void call is wired up.Since this simple initial test hit
flutter/flutter#111083, which caused the test to fail, this includes a fix for that.
Short-term future work (by me):
Medium-term future work (not all by me):
Part of flutter/flutter#111505
Fixes flutter/flutter#111083
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).