-
Notifications
You must be signed in to change notification settings - Fork 390
docs(http): add http.client Testing section with Flutter testing cookbook recommendation #1836
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
docs(http): add http.client Testing section with Flutter testing cookbook recommendation #1836
Conversation
PR HealthChangelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with Coverage ✔️
This check for test coverage is informational (issues shown here will not fail the PR). This check can be disabled by tagging the PR with License Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
This check can be disabled by tagging the PR with |
brianquinlan
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.
Awesome! Thank you for this!
pkgs/http/README.md
Outdated
|
|
||
| ## Testing | ||
|
|
||
| For better testability, especially in Flutter applications, it's recommended to use a [Client][] instance rather than the top-level functions like `http.get()` or `http.post()`. This approach makes it easier to mock HTTP requests in your tests. |
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.
Could you wrap the lines to 80 columns?
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.
Noted
pkgs/http/README.md
Outdated
| ``` | ||
|
|
||
| > [!TIP] | ||
| > For more detailed testing guidance, see the |
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.
Maybe use more neutral language about mockito:
You can also use
package:mockitoto mock `http.Client.For more detailed guidance, see the Flutter Testing Cookbook.
|
|
||
| Some well-supported implementations are: | ||
|
|
||
| | Implementation | Supported Platforms | SDK | Caching | HTTP3/QUIC | Platform Native | |
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.
Could you restore the original formatting? It's hard to read this in a narrow window.
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.
Okay
pkgs/http/README.md
Outdated
|
|
||
| > [!TIP] | ||
| > [The Flutter HTTP example application][flutterhttpexample] demonstrates | ||
| > [!TIP] > [The Flutter HTTP example application][flutterhttpexample] demonstrates |
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.
Please restore this.
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.
Okay
pkgs/http/README.md
Outdated
|
|
||
| > [!TIP] | ||
| > [The Flutter HTTP example application][flutterhttpexample] demonstrates | ||
| > [!TIP] > [The Flutter HTTP example application][flutterhttpexample] demonstrates |
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.
Please restore this.
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.
Okay
|
@brianquinlan, thank you for reviewing the PR. I have addressed your comments and pushed the updates. |
|
@brianquinlan, I have addressed the failing health check |
brianquinlan
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.
Thank you for writing this!
Summary
Adds a Testing section to the README that addresses the Flutter testing cookbook recommendation to use
http.Clientinstances instead of static methods for better testability.Changes
DataServiceclassMockClienttesting example with complete test caseRelated Issue
Fixes #389
Testing