pulyaevskiy/test-coverage
Runs tests in Dart VM and collects coverage data.
github 로 이동하여 다운로드test_coverage
![Coverage](https://raw.githubusercontent.com/pulyaevskiy/test-coverage/master/coverage_badge.svg?sanitize=true)
A simple command-line tool to collect test coverage information from
Dart VM tests. It is useful if you need to generate coverage reports
locally during development.
Usage
Add dev dependency to your pubspec.yaml
:
dev_dependencies:
test_coverage: ^0.4.2
Run pub get
to install. Then, in the root of your project run:
pub run test_coverage
Result is saved in coverage/lcov.info
. If you have lcov
tool
installed on your system (for Mac it’s brew install lcov
) you can
generate coverage reports using genhtml
command:
genhtml -o coverage coverage/lcov.info
# Open in the default browser (mac):
open coverage/index.html
Integrations
Resulting coverage/lcov.info
file is ready to be consumed by
Codecov command-line tool, so no extra step is needed.
This library was not tested with coveralls yet.
Generating badge image
Coverage badge SVG image is automatically generated and saved to coverage_badge.svg
in your
project root directory. You can add it to Git and use in README.md on Github as follows:
![Coverage](https://raw.githubusercontent.com/{you}/{repo}/master/coverage_badge.svg?sanitize=true)
If you don’t need it you can pass --no-badge
flag when running test coverage.
Known limitations
- This library was created to run Dart VM tests. It has not been tested
and likely won’t work for Dart code targeting web platform (compiled
to JavaScript). There is no need to use this tool for Flutter as it
allows collecting coverage information withflutter test --coverage
.
How it works
The tool performs following steps:
1. Generates test/.test_coverage.dart
file (a “test all” script).
Scans your test/
directory to find all *_test.dart
files and creates test/.test_coverage.dart
which imports all found test files and runs corresponding main()
of all tests functions within
the same file (and process), which simplifies collection of coverage information.
It is recommended to add this file to your .gitignore
.
Below is an example of test/.test_coverage.dart
:
// Auto-generated by test_coverage. Do not edit by hand.
// Consider adding this file to your .gitignore.
import 'some_test.dart' as some_test;
import 'nested/other_test.dart' as other_test;
import 'some_other_test.dart' as some_other_test;
void main() {
some_test.main();
other_test.main();
some_other_test.main();
}
2. Runs the tests
Following command is used to run the tests:
dart --pause-isolates-on-exit --enable_asserts --enable-vm-service \
test/.test_coverage.dart
3. Collects and formats coverage information
When test execution is completed the tool uses functionality of the
coverage
package to collect and format coverage report.
Feel free to file feature requests and bug reports at the
issue tracker.
4. Minimal coverage percentage
Set minimal coverage percentage to pass
min-coverage
percentage value of coverage.
5. See test output
print-test-output
to show test output.
Show output of tests
Feel free to file feature requests and bug reports at the
issue tracker.
![](/images/banner-woo.jpg)
pulyaevskiy/test-coverage 에 관련된 우수 프로젝트 추천 다운로드
bloc
11441
A predictable state management library that helps implement the BLoC design pattern
getwidget
4416
Most popular and easy to use open source UI library with 1000+ Widgets to build flutter app.
flutter_spinkit
2945
✨ A collection of loading indicators animated with flutter. Heavily Inspired by http://tobiasahlin.com/spinkit.
flutter-quill
2372
Rich text editor for Flutter
zefyr
2215
Soft and gentle rich text editing for Flutter applications.
flutter_redux
1648
A library that connects Widgets to a Redux Store
image
1130
Dart Image Library for opening, manipulating, and saving various different image file formats.
wave
1068
A Flutter package for displaying waves.
flutter_offline
1002
✈️ A tidy utility to handle offline/online connectivity like a Boss
equatable
885
A Dart package that helps to implement value based equality without needing to explicitly override == and hashCode.
betterplayer
871
Better video player for Flutter, with multiple configuration options. Solving typical use cases!
catcher
773
Flutter error catching & handling plugin. Handles and reports exceptions in your app!
qr.flutter
688
QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter.
smooth-app
673
The new Open Food Facts mobile application for Android and iOS, crafted with Flutter and Dart
flutter_clean_architecture
661
Clean architecture flutter: A Flutter package that makes it easy and intuitive to implement Uncle Bob's Clean Architecture in Flutter. This package provides basic classes that are tuned to work with Flutter and are designed according to the Clean Architecture.
socket.io-client-dart
640
socket.io-client-dart: Dartlang port of socket.io-client https://github.com/socketio/socket.io-client
functions-framework-dart
532
FaaS (Function as a service) framework for writing portable Dart functions
alice
522
HTTP Inspector for Flutter. Allows checking HTTP connections with UI inspector.
jiffy
516
Jiffy is a Flutter (Android, IOS and Web) date time package for parsing, manipulating, querying and formatting dates
timeago.dart
515
A library useful for creating fuzzy timestamps. (e.g. "5 minutes ago")