搜索插件、代码仓与 APP 分类

插件详情v1.0.0

full_coverage

一个包脚本,用于让覆盖率测试工具能够查看所有Dart文件。

AndroidiOSmacOSWindowsLinux
近 30 天下载
1.2万
喜欢数
24
Pub 分数
155

安装插件

flutter pub add full_coverage

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

full_coverage 包是一个脚本工具,旨在确保覆盖率测试工具能够检测和分析 Flutter 项目中的所有 Dart 文件。它解决了测试运行器发现源文件时某些文件被排除在覆盖率报告之外的常见问题。通过集成此包,开发者可以获得整个代码库中更准确的代码覆盖率指标,从而提高测试的可靠性。它支持多种平台,包括 Android、iOS、macOS、Windows 和 Linux。

适合场景

  • 确保 CI/CD 流水线中的完整代码覆盖率
  • 提高测试报告的准确性
  • 调试特定文件缺失的覆盖率
  • 支持全面的测试工作流程
  • 与覆盖率分析工具集成

主要特点

  • 自动包含所有 Dart 文件以进行覆盖率扫描
  • 通过 Flutter pub add 简单集成
  • 跨平台兼容性
  • 提高未测试代码的可见性
  • 可与现有测试套件无缝配合

适合对象

  • 专注于高测试覆盖率的Flutter团队
  • CI/CD 环境需要可靠的覆盖率数据
  • 开发者排查覆盖范围缺口
  • 使用覆盖率工具(如 `coverage` 或 `dart test --coverage`)的项目
  • 致力于符合测试标准的团队

使用建议

  • 测试脚本中需要正确配置
  • 如果使用自定义文件发现,可能需要进行调整
  • 不是独立的测试工具,而是补充
  • 最好与结构化测试实践结合使用
  • 不生成测试——仅提高覆盖率可见性

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

full_coverage

Coverage tools like codecov only see the files that were actually triggered by tests. This means that a coverage of 100% can easily be a lie, e.g. you can just write a dummy test that does not import any files and a coverage tool will ignore all the code base.

Luckily, this package resolves this problem.

How it works

The full_coverage package harvests the power of Bash to find all files in specified directory, by default it is lib directory, where all Flutter files are. It then creates a dummy test file test/full_coverage_test.dart that imports all the Dart files that were found and has an empty void main() {} function so that it actually starts.

Install

Use this command:

dart pub global activate full_coverage

Execute

Use the command:

dart pub global run full_coverage

Or add the cache-system to your PATH environment variable for run directly. Check documentation for more;

full_coverage

Other commands

-i, --ignore       Ignore files. ex (*_widget.dart,*_page.dart).
-h, --[no-]help    usage doc.

For more details Telegram Group Flutterando.

所属分类

依赖

依赖清单 2 项

源码仓库

使用此插件的项目