tracera_flutter 0.1.0 copy "tracera_flutter: ^0.1.0" to clipboard
tracera_flutter: ^0.1.0 copied to clipboard

Tracera Autotest adapter for Flutter widget and integration tests: bind, steps, lifecycle sections, screenshots and attachments.

tracera_flutter #

Tracera Autotest adapter for Flutter widget tests and integration_test.

Requires Dart ≥ 3.8 and Flutter ≥ 3.24.

flutter pub add dev:tracera_flutter

Call installTracera() once at the top of the main function, or in flutter_test_config.dart. Keep the stock flutter_test and integration_test imports; add only installTracera, the screenshot helpers, and the tracera calls:

import 'package:flutter_test/flutter_test.dart';
import 'package:tracera/tracera.dart' as tracera;
import 'package:tracera_flutter/tracera_flutter.dart';

void main() {
  installTracera();

  testWidgets('user can sign in', (tester) async {
    await tracera.step('pump login', () async {
      await tester.pumpWidget(/* … */);
    });
  }, tags: ['tracera-id-42']);
}

How-to: flutter. Shared env / run mode: Autotest adapters.

Bind #

Add the tag tracera-id-‹id› to a testWidgets, test, or group. Add tracera-name-‹name› to set autotestName. A name tag cannot contain spaces; to use spaces, bind inside the test with tracera.testCase(id, 'name'). If the name tag is omitted, autotestName takes the value of the Flutter test name.

To silence warnings about undefined tags, list the Tracera tags under tags: in dart_test.yaml.

Skip #

Call markTestSkipped('reason') inside the test. The result is reported as Skipped, and the reason is added to the result as comment. The skip: argument on testWidgets or group is not reported.

Steps #

Use tracera.step('…', () { … }). A setUp callback maps to Setup, the test body to Test, and a tearDown callback to Teardown. Steps inside setUpAll / tearDownAll are not reported.

Comments, errors, and attachments #

tracera.comment, tracera.error, and attachments are added to the open step, or to the result when no step is open. tracera.attachmentFile takes a file path; tracera.attachmentBytes takes a name and bytes, with an optional mimeType. Shared placement rules and limits: Autotest adapters.

Screenshots #

Screenshots are PNG attachments from a capture or from bytes you pass.

  • attachScreenshot(tester) captures the first RepaintBoundary in a widget test.
  • attachScreenshotBytes(bytes) attaches PNG bytes you already have.
  • attachIntegrationScreenshot(name: 'checkout') takes a device screenshot in integration_test.

Parameterized #

Create one testWidgets in a loop for each row. If the name is omitted, autotestName takes the value of the test name, so give each row a distinct title, or pass a name to tracera.testCase(id, 'name'). When a test is retried, only the final attempt is reported, and the Env tab includes FLUTTER_RETRY.

0
likes
135
points
549
downloads

Documentation

Documentation
API reference

Publisher

verified publishertracera.dev

Weekly Downloads

Tracera Autotest adapter for Flutter widget and integration tests: bind, steps, lifecycle sections, screenshots and attachments.

Homepage
View/report issues

Topics

#tracera #autotest #flutter #test-reporting #testops

License

unknown (license)

Dependencies

flutter, flutter_test, integration_test, path, test, test_api, tracera

More

Packages that depend on tracera_flutter