搜索分类、插件与代码仓

插件详情v2.0.1

testreport

此库可用于处理 Dart 测试的结果。它会处理由 Dart 测试运行器生成的 `json` 输出数据,并提供一个 API 来访问测试结果。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
34.7万
喜欢数
3
Pub 分数
160

安装插件

flutter pub add testreport

插件介绍

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

testreport 包处理由 Dart 测试运行器生成的 JSON 输出中的 Dart 测试结果。它提供了一个结构化的 API,用于解析、分析并从测试结果中提取有意义的信息,例如通过/失败状态、持续时间以及错误。这对于将测试结果集成到 CI/CD 流水线、生成报告或跨平台可视化测试性能特别有用。该库支持所有主要的 Flutter 平台,使其非常适合跨平台测试工作流程。

适合场景

  • CI/CD 集成
  • 测试结果分析
  • 自动报告
  • 跨平台测试
  • 测试仪表板

主要特点

  • JSON 结果解析
  • Platform-agnostic
  • 错误和持续时间提取
  • 结构化数据 API
  • 支持所有 Flutter 平台

适合对象

  • CI/CD 系统
  • 测试自动化团队
  • 质量保证工程师
  • 使用 Flutter 的开发者
  • 报告工具

使用建议

  • 需要来自 dart 测试运行器的 JSON 输出
  • 限于测试后处理
  • 无实时测试监控
  • 取决于测试运行器输出格式
  • 不用于直接运行测试

原始 README

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

Test Report

Introduction

This library can be used to process the results of dart tests.

The goal of this library is to process the data from the json output emitted by the dart test runner and provide an API to the interpreted test results.

Purpose

By running

pub run test simple_test.dart --reporter json

and the contents of simple_test.dart is

import 'package:test/test.dart';

main() {
  test('simple', () {
    expect(true, true);
  });
}

the dart test runner will output the results of the test in json format as a stream of events:

{"protocolVersion":"0.1.0","runnerVersion":"0.12.13+1","type":"start","time":0}
{"count":1,"type":"allSuites","time":0}
{"suite":{"id":0,"platform":"vm","path":"simple_test.dart"},"type":"suite","time":0}
{"test":{"id":1,"name":"loading simple_test.dart","suiteID":0,"groupIDs":[],"metadata":{"skip":false,"skipReason":null}},"type":"testStart","time":0}
{"testID":1,"result":"success","hidden":true,"type":"testDone","time":237}
{"group":{"id":2,"suiteID":0,"parentID":null,"name":null,"metadata":{"skip":false,"skipReason":null},"testCount":1},"type":"group","time":241}
{"test":{"id":3,"name":"simple","suiteID":0,"groupIDs":[2],"metadata":{"skip":false,"skipReason":null}},"type":"testStart","time":242}
{"testID":3,"result":"success","hidden":false,"type":"testDone","time":268}
{"success":true,"type":"done","time":271}

From this json output, it is not easy to see how many tests were executed, how many failed and how much time was spent in each test.

The Processor in this project takes the json events, and turns them into a Report, that is suitable for further processing.

License and contributors

所属分类

源码仓库

使用此插件的项目