Lesson 23: Collecting code coverage from your tests #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
PR with Lesson 23.
How to install LCOV on:
brew install lcov
sudo apt-get install lcov
To generate de coverage report:
flutter test --coverage
Now, check your root project, and you will see a new folder with the name
coverage
, and inside this folder a file with the namelcov.info
.If you open this file, will see something like that, hard to understand:
Then, after install the LCOV, run this command:
genhtml ./coverage/lcov.info -o coverage
And will be generated this, inside the
coverage
folder:Now, let's check the real coverage report, running this command:
open coverage/index.html
And an HTML page will open in your browser:
Now, if you check one of these files, you’ll see that you don’t have 100% test coverage. If you open one of these files, you will see a red line in some part of your code, and that red line my friend (probably) is the part that remains to be tested to reach approximately or 100% test coverage in that file.
Types of changes