Skip to main content
Version: 1.x

Class: ODataTraceReporter

Aggregates OData request trace data from Playwright test attachments.

Remarks​

Attach OData trace data in tests using testInfo.attach('odata-trace', ...), and this reporter will collect and aggregate the data into a JSON report.

Example​

// playwright.config.ts
import { defineConfig } from '@playwright/test';

export default defineConfig({
reporter: [
['./src/reporters/odata-trace-reporter.ts', { outputDir: 'reports' }],
],
});

Implements​

  • Reporter

Constructors​

Constructor​

new ODataTraceReporter(options?): ODataTraceReporter

Parameters​

options?​

ODataTraceReporterOptions

Returns​

ODataTraceReporter

Methods​

onEnd()​

onEnd(_result): Promise<void>

Writes the aggregated OData trace report to odata-trace.json.

Parameters​

_result​

FullResult

The full test run result (unused).

Returns​

Promise<void>

Example​

await reporter.onEnd(fullResult);

Implementation of​

Reporter.onEnd


onError()​

onError(error, workerInfo?): void

Logs worker context when Playwright reports a runtime or fixture-teardown error.

Parameters​

error​

TestError

The error Playwright encountered.

workerInfo?​

PramanWorkerInfo

Worker context (Playwright 1.60+); undefined on older versions.

Returns​

void

Example​

reporter.onError(error, workerInfo);

Implementation of​

Reporter.onError


onTestEnd()​

onTestEnd(test, result): void

Collects OData trace entries from test result attachments.

Parameters​

test​

TestCase

The completed test case.

result​

TestResult

The test result containing attachments.

Returns​

void

Example​

reporter.onTestEnd(testCase, testResult);

Implementation of​

Reporter.onTestEnd


printsToStdio()​

printsToStdio(): boolean

Indicates this reporter does not write to stdout/stderr.

Returns​

boolean

Always false.

Example​

reporter.printsToStdio(); // false

Implementation of​

Reporter.printsToStdio