-
-
Notifications
You must be signed in to change notification settings - Fork 940
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
[Bug]: package_info_plus fails PackageInfo.fromPlatform()
under test
#1309
Comments
This is similar to #1270 But I am not using Linux and it is only when running as a test. |
Because thats not how you write an integration test. Take a look at the included integrated tests in the repo. |
If you mean this example I am not finding it much help. That code tests package_info_plus in very general terms. I want to test it in my specific case. Starting from the example supplied I cannot get the most basic services of my code (specifically using the HTTPS client) to work. I am unsure if you can help. This is a problem with the flutter test system that as far as I can tell is mostly undocumented. Each piece has a documentation page, but the way it is tied together is not covered by the official documentation. OT but the Dart test framework has better documentation, most of it applies, but not all of it. The intersection of Flutter and Dart test frameworks is not covered. Sigh. This package is going to work. Just not in my tests. |
If you mean this example I am not finding it much help. That code tests package_info_plus in very general terms. I want to test it in my specific case. Starting from the example supplied I cannot get the most #basic services of my code (specifically using the HTTPS client) to work. I am unsure if you can help. This is a problem with the flutter test system that as far as I can tell is mostly undocumented. Each piece has a documentation page, but the way it is tied together is not covered by the official documentation. OT but the Dart test framework has better documentation, most of it applies, but not all of it. The intersection of Flutter and Dart test frameworks is not covered. Sigh. This package is going to work. Just not in my tests. |
That's a unit test. And you are calling to platform channel through a unit test. That's not how Flutter works. Instead, you have to implement an integration test: https://github.com/fluttercommunity/plus_plugins/blob/main/packages/package_info_plus/package_info_plus/example/integration_test/package_info_plus_test.dart Anyway, I am not sure why you are calling these methods inside a test. Either you should mock them or you should write integration tests instead. Also, don't open a bug ticket for something that should have been a StackOverflow question. |
Platform
MacOS 12.6
Plugin
package_info_plus
Version
3.0.1
Flutter SDK
3.3.6 Flutter version. From
flutter --version
Steps to reproduce
Make a test:
Fails at platform_chanel.dart: 294
throw MissingPluginException("No implementation found for method getAll on channel dev.fluttercommunity.plus/package_info");
This code works fine when run inside an App.
Code Sample
Flutter Doctor
Checklist before submitting a bug
flutter pub upgrade
flutter clean
The text was updated successfully, but these errors were encountered: