-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Crdzbird/unit test flutter #259
Changes from 8 commits
56e31f3
4f944d5
7192568
13c4b55
72c010c
9a8972c
d6462fb
99389ea
926f957
1288e89
5262b35
245b7b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,43 @@ Once the required tools are installed and the lfs are downloaded, open the proje | |
- Edit the run config and add on the flavor option prod | ||
|
||
|
||
## Unit Tests | ||
|
||
To run the unit test you need to input the following setup. | ||
- Create a folder on the root of your project named: ```.vscode``` | ||
- Inside .vscode create a file named: ```launch.json``` | ||
- Add the following inside ```launch.json``` | ||
- The segment named `program` is to specificy if you wish to run all the U.T or a specific one. | ||
|
||
```json | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Widget Test", | ||
"program": "test/", | ||
"request": "launch", | ||
"type": "dart", | ||
"flutterMode": "debug", | ||
"args": [ | ||
"--coverage" | ||
] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
|
||
<p> </p> | ||
|
||
### Unit Test Graph | ||
|
||
If you wanna visualize the current percentage of code coverage you need to do the following steps. | ||
|
||
1. On your `terminal` check if you have installed: `lcov` if not then install. | ||
2. Go to on your terminal `android-lantern/coverage` and type: `genhtml coverage/lcov.info -o coverage/html` that will generate a nice html file with the code coverage of all your files. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explanation about how to generate a informative graph about the percentage of code coverage on the project. |
||
#### NOTE: Please avoid to upload the generated files from coverage, this is because the numerous files that are created. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please add the necessary directories/files to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, im gonna omit the |
||
|
||
### Extra | ||
|
||
If you like that VSCode start running the project without the need of be constantly typing the command. | ||
|
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.
Is there a way to do this from the command line?
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.
yep. an example would be:
flutter run test/catcher_test.dart --coverage or
flutter run test/catcher_test.dart
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.
if you wish to run everything just replace the catcher_test with an * and it should run everything
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.
Thanks! Could you add that to the readme please?
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.
Sure.