Skip to content

#Flutter #82

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,31 @@ Do you relly needed it? It makes more sense to write the code or copy the code t
- How frequently does the package get updated? This is really important if we want to take advantage of the latest Dart features.

### Tests
* Write tests for critical functionality
Write tests for critical functionality

The contingencies of relying on manual testing will always be there, having an automated set of tests can help you save a notable amount of time and effort. As Flutter mainly targets multiple platforms, testing each and every functionality after every change would be time-consuming and call for a lot of repeated effort.

Let’s face the facts, having 100% code coverage for testing will always be the best option, however, it might not always be possible on the basis of available time and budget. Nonetheless, it’s still essential to have at least tests to cover the critical functionality of the app.

Unit and widget tests are the topmost options to go with from the very beginning and it’s not at all tedious as compared to integration tests.

- Unit test
- For all code beside the UI Widgets.
- One set of unit tests usually tests a single class.
- Widget test
- For testing a single widget
- Integration test
- For testing large parts of the app from the user perspective

| | Unit | Widget | Integration |
| ------------ | ------------ | ------------ | ------------ |
| Confidence | Low | Higher | Highest |
| Maintenance cost | Low | Higher | Highest |
| Dependencies | Few | More | Most |
| Excecution speed | Quick | Quick | Slow |

Official documentation
https://docs.flutter.dev/cookbook/testing/unit/introduction

Demo project
https://github.com/huanachin/flutter_unit_test