This repository contains various tools and utilities for generating and deploy reports for Dart applications
Dart test core packages does not provide a way to inject custom reporting logic when you call dart test.
To workaround this problem there is test_reporter cli tool which wraps dart test process and processes events from it.
test_reporter uses dynamic package loading with Isolates. You can write your own reporter package and provide it to test_reporter. See allure_report for example.
Prepend your test command with test_reporter
dart run test_reporter -- dart testYou can use it with Flutter tests
dart run test_reporter -- flutter testYou can pass arguments to dart/flutter tests as is
dart run test_reporter -- flutter test --tags golden --coverage- Add
allure_reportandtest_reporterto your dependencies.
dev_dependencies:
# reporter
allure_report: ^1.0.0
test_reporter: ^1.0.0- Create
reporter.dartintestdirectory. If no file created, Basic Console Reporter will be used.
import 'package:allure_report/allure_report.dart';
import 'package:test_reporter/test_reporter.dart';
TestReporter create() {
return AllureReporter();
}- Run test_reporter command with your tests
dart run test_reporter -- dart testdart run test_reporter -- flutter testAllure results are placed in allure-results folder in project root folder.
Warning
Full Allure format is not supported. Not all features are available at the moment.
Full spec support is needs further development
allures is meant to be used to upload reports to OSS Allure Server
See Allure Server repository to find instructions to build it up and running.
dart pub global activate allure_server_cliCommand will be available with name allures
allures --helpTo upload results to Allure server you should zip results to ZIP Archive
zip -r allure-results.zip allure-results/
Then you can upload report to Allure server with nex command
allures --host http://localhost:8080 report --upload allure-results.zip --path developSee help for additional usage info
allures --helpThis repository is a mono-repo managed with melos.
Each utility (e.g. test_reporter, allure_report, allure_server_cli) is
located in the packages/ directory and developed as an independent Dart package.
-
Dart SDK (>=3.0)
-
Flutter SDK (for Flutter-based testing)
-
melosinstalled globally:dart pub global activate melos
Bootstrap the workspace after cloning or pulling changes:
melos bootstrapThis installs all package dependencies and links local packages.
-
Format all code:
melos format
-
Analyze all packages:
melos analyze
-
Run tests:
melos run test -
Run a script for a specific package:
melos run test --scope=allure_report -
Preview Allure report after running tests
melos preview
or
npx allure-commandline serve allure-results
Warning
It is hobby-time project created for research of possibility to integrate Dart tests with Allure Reporting Framework.
I am not currently supposed to support it as full-feature set by only myself. It depends on demand and user activity.
Feel free to contribute :-)