From 3d943d7d460527d0c69b94b33de97841de027832 Mon Sep 17 00:00:00 2001 From: Abdullah Deshmukh Date: Thu, 10 Dec 2020 12:46:18 +0530 Subject: [PATCH] Add instructions to generate test coverage report (#613) --- testing_app/README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/testing_app/README.md b/testing_app/README.md index ca53a8112..02589c386 100644 --- a/testing_app/README.md +++ b/testing_app/README.md @@ -41,7 +41,17 @@ The Flutter SDK can run unit tests and widget tests in a virtual machine, withou - State Management Tests: - For testing state using Flutter Driver - Run `flutter drive --target=test_driver/` - + +### To generate test coverage report: +- Install the `lcov` tool: + - For MacOS, run `brew install lcov` + - For Linux, run `sudo apt install lcov` +- Run tests with coverage: + - `flutter test --coverage` +- Convert `lcov.info` into readable html: + - Run `genhtml coverage/lcov.info -o coverage/index` +- Open `coverage/index/index.html` in your preferred browser. + ### CI/CD - Refer [.travis.yml](../.travis.yml) and the [tool](../tool) directory to see how to test Flutter projects using Travis-CI.