allure_dart_commons 1.1.0 copy "allure_dart_commons: ^1.1.0" to clipboard
allure_dart_commons: ^1.1.0 copied to clipboard

Framework-agnostic Allure lifecycle and result primitives for Dart.

example/main.dart

import 'dart:io';

// Import the framework-agnostic Allure APIs when integrating a custom runner.
import 'package:allure_dart_commons/allure_dart_commons.dart';

Future<void> main() async {
  final resultsDirectory = await Directory.systemTemp.createTemp(
    'allure-dart-commons-example-',
  );
  final lifecycle = AllureLifecycle(
    writer: AllureResultsWriter(outputDirectory: resultsDirectory.path),
  );

  final testUuid = lifecycle.startTest(
    name: 'framework agnostic example',
    labels: const <AllureLabel>[
      AllureLabel(name: 'framework', value: 'custom'),
    ],
  );

  await lifecycle.runStep(testUuid, 'verify arithmetic', () {
    final answer = 40 + 2;
    if (answer != 42) {
      throw StateError('Expected 42, got $answer');
    }
  });

  await lifecycle.addTextAttachment(
    testUuid: testUuid,
    name: 'calculation',
    type: 'text/plain',
    content: '40 + 2 = 42',
  );

  await lifecycle.stopTest(testUuid, status: AllureStatus.passed);
  await lifecycle.writeTest(testUuid);

  stdout.writeln('Allure results written to ${resultsDirectory.path}');
}
0
likes
160
points
173
downloads

Documentation

API reference

Publisher

verified publisherallurereport.org

Weekly Downloads

Framework-agnostic Allure lifecycle and result primitives for Dart.

Repository (GitHub)
View/report issues
Contributing

License

Apache-2.0 (license)

Dependencies

crypto, mime, path, uuid

More

Packages that depend on allure_dart_commons