搜尋分類、套件與程式碼儲存庫

套件詳情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 項

原始碼儲存庫

使用此套件的專案