tracera_test
Tracera Autotest adapter for the Dart test package.
Requires Dart ≥ 3.8 and package:test ≥ 1.25.
dart pub add dev:tracera_test
Call installTracera() once at the top of the main function. Keep the stock package:test imports; add only installTracera and the tracera calls:
import 'package:test/test.dart';
import 'package:tracera/tracera.dart' as tracera;
import 'package:tracera_test/tracera_test.dart';
void main() {
installTracera();
test('user can sign in', () {
tracera.step('open login', () { /* … */ });
}, tags: ['tracera-id-42']);
}
How-to: dart-test. Shared env / run mode: Autotest adapters.
Bind
Add the tag tracera-id-‹id› to a 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 package:test test name.
To silence package:test 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 test 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.
Parameterized
Create one test 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 with retry:, only the final attempt is reported, and the Env tab includes DART_TEST_RETRY.
Libraries
- tracera_test
- Tracera Autotest adapter for the Dart
testpackage.