搜索分类、插件与代码仓

插件详情v2.0.2

junitreport

从 dart 测试运行生成 JUnit XML 报告。将 dart 或 flutter 测试的输出转换为 JUnit 样式的 XML

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
29.7万
喜欢数
36
Pub 分数
150

安装插件

flutter pub add junitreport

插件介绍

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

junitreport 包可从 Dart 或 Flutter 测试运行中生成 JUnit XML 格式的测试报告。它将默认的测试输出转换为与 CI/CD 系统和测试仪表板兼容的标准 XML 结构。这使得与 Jenkins、GitHub Actions 及其他期望 JUnit 风格报告的平台实现无缝集成成为可能。该包支持所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,非常适合跨平台测试自动化工作流程。

适合场景

  • CI/CD 流水线报告
  • 将测试结果与 Jenkins 集成
  • 在 GitHub Actions 中可视化测试结果
  • 自动化测试结果聚合
  • 跨平台测试报告

主要特点

  • 将 Dart 测试输出转换为 JUnit XML
  • 支持所有 Flutter 平台
  • 轻松集成到CI系统
  • 轻量级且专注于报告
  • 生成结构化、机器可读的输出

适合对象

  • 使用 CI/CD 流水线的团队
  • 测试自动化工程师
  • 需要标准化测试报告的项目
  • 与 Jenkins 或 GitHub Actions 集成的开发者
  • 跨平台 Flutter 应用程序

使用建议

  • 需要在测试运行器中进行手动设置
  • 不运行测试—仅格式化输出
  • 可能需要为复杂的测试套件进行额外配置
  • 不适用于实时测试调试
  • 测试执行后输出为静态

原始 README

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

JUnit Report

Introduction

This application can be used to convert the results of dart tests to JUnit xml reports. These XML reports can then be used by other tools like Jenkins CI.

By running

dart test simple_test.dart --reporter json > example.jsonl
dart pub global run junitreport:tojunit --input example.jsonl --output TEST-report.xml

and the contents of simple_test.dart is

import 'package:test/test.dart';

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

this program will generate 'TEST-report.xml' containing

<testsuites>
  <testsuite errors="0" failures="0" tests="1" skipped="0" name="simple" timestamp="2016-05-22T21:20:08">
    <properties>
      <property name="platform" value="vm" />
    </properties>
    <testcase classname="simple" name="simple" time="0.026" />
  </testsuite>
</testsuites>

For transforming Flutter tests reports, instead of passing --reporter json, you need to use --machine.

Installation

Run dart pub global activate junitreport to download the program and make a launch script available: <dart-cache>/bin/tojunit.

If the <dart-cache>/bin directory is not on your path, you will get a warning, including tips on how to fix it.

Once the directory is on your path, tojunit --help should be able to run and produce the program help.

Then you can also use the example above much simpler:

dart test simple_test.dart --reporter json | tojunit

And to run all tests for Flutter:

flutter test --machine | tojunit

License and contributors

所属分类

依赖

依赖清单 4 项

源码仓库

使用此插件的项目