Mobile 1,187 installs

Implementing Dart and Flutter Test Coverage

by dart-lang/skills

Collect coverage using the coverage packge and create an LCOV report

Skill content

Implementing Dart and Flutter Test Coverage

Contents

- Testing Fundamentals

- Coverage Directives

- Workflow: Configuring and Generating Coverage Reports

- Workflow: Advanced Manual Coverage Collection

- Examples

Testing Fundamentals

Structure your test suites using the standard Dart testing paradigms. Use package:test for Dart projects and flutter_test for Flutter projects.

- Unit Tests: Verify individual functions, methods, or classes.

- Component/Widget Tests: Verify component behavior, layout, and interaction using mock objects (package:mockito).

- Integration Tests: Verify entire app flows on simulated or real devices.

Coverage Directives

Exclude specific lines, blocks, or entire files from coverage metrics using inline comments. Pass the --check-ignore flag during formatting to enforce these directives.