tracera
Tracera Autotest adapter core for Dart (HTTP, flush, log, dotenv, Env, context).
Requires Dart SDK ≥ 3.8.
dart pub add tracera
import 'package:tracera/tracera.dart' as tracera;
Pick a runner package unless you are writing a custom integration.
Bind
Declarative bind lives on the runner. Inside a running test you can also rebind imperatively:
tracera.testCase(101); // id only — the runner supplies the name
tracera.testCase(101, 'checkout flow'); // id + reported result name
Skip
Use the runner's skip API so the reason becomes the result comment.
Steps
Use tracera.step('…', () { … }). Steps nest, and a thrown error marks the step
Failed with the captured stack before propagating.
tracera.step('open the cart', () {
tracera.step('add an item', () { /* ... */ });
});
await tracera.step('charge the card', () async {
await gateway.charge();
});
Two steps started concurrently (Future.wait) are not guaranteed to nest —
await them one at a time when the tree matters.
Comments, errors, and attachments
tracera.comment, tracera.error and the attachment helpers land on the open
step, or on the result when no step is open. tracera.error only adds error
text — it does not fail the test; the runner marks Failed.
Attach a file from disk with tracera.attachmentFile (it is uploaded when the
result is reported, so the file must still exist then) or in-memory bytes with
tracera.attachmentBytes (the bytes are copied). The MIME type is optional. Up
to ten attachments land on a step, and ten more on the result.
tracera.step('charge the card', () {
tracera.comment('sandbox gateway');
tracera.error('retried once');
tracera.attachmentFile('test/fixtures/receipt.pdf');
tracera.attachmentBytes('response.json', body, mimeType: 'application/json');
});
tracera.attachment takes a blob that is already uploaded — reach for it only
when you hold a Tracera attachment id.
Work that starts outside the test's own async context does not inherit the active test. Capture the context and pin it there:
final ctx = tracera.getContext();
await Future(() => tracera.runWithContext(ctx, () {
tracera.step('background check', () { /* ... */ });
}));
Parameterized
Table-driven suites report one result per bound row. Bind with the id for that
row (runner helper or mid-body tracera.testCase); keep the reported name
literal or use the native table title — there is no Tracera {param} template
on Dart tags.
Several test processes
Usual case: one process, one test run — nothing extra to set.
Only when you start several OS processes and want them in the same run:
give each a different TRACERA_PEER_WORKER for that launch. The first process
opens the run; the last closes it. You do not create the run by hand.
Environment variables and .env lookup:
Autotest adapters.
License
Apache-2.0. Copyright 2026 Tracera.