Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,19 @@ export class ScoutJestReporter extends BaseReporter {
...this.baseTestRunInfo,
status: results.numFailedTests === 0 ? 'passed' : 'failed',
duration: Date.now() - results.startTime || 0,
tests: {
failures: results.numFailedTests,
passes: results.numPassedTests,
pending: results.numPendingTests,
total: results.numTotalTests,
},
},
event: {
action: ScoutReportEventAction.RUN_END,
},
process: {
uptime: Math.floor(process.uptime() * 1000),
},
});

// Save & conclude the report
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ export class ScoutPlaywrightReporter implements Reporter {
private baseTestRunInfo: ScoutTestRunInfo;
private readonly codeOwnersEntries: CodeOwnersEntry[];

private readonly testStats: {
passes: number;
failures: number;
pending: number;
} = {
passes: 0,
failures: 0,
pending: 0,
};

constructor(private reporterOptions: ScoutPlaywrightReporterOptions = {}) {
this.log = new ToolingLog({
level: 'info',
Expand Down Expand Up @@ -227,6 +237,26 @@ export class ScoutPlaywrightReporter implements Reporter {
}

onTestEnd(test: TestCase, result: TestResult) {
switch (result.status) {
case 'failed':
this.testStats.failures++;
break;
case 'interrupted':
this.testStats.failures++;
break;
case 'timedOut':
this.testStats.failures++;
break;

case 'passed':
this.testStats.passes++;
break;

case 'skipped':
this.testStats.pending++;
break;
}

this.report.logEvent({
...environmentMetadata,
reporter: {
Expand Down Expand Up @@ -269,10 +299,19 @@ export class ScoutPlaywrightReporter implements Reporter {
...this.baseTestRunInfo,
status: result.status,
duration: result.duration,
tests: {
failures: this.testStats.failures,
passes: this.testStats.passes,
pending: this.testStats.pending,
total: this.testStats.failures + this.testStats.passes + this.testStats.pending,
},
},
event: {
action: ScoutReportEventAction.RUN_END,
},
process: {
uptime: Math.floor(process.uptime() * 1000),
},
});

// Save, upload events & conclude the report
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ export interface ScoutTestRunInfo {
};
status?: string;
duration?: number;
tests?: {
passes?: number;
pending?: number;
failures?: number;
total?: number;
};
}

/**
Expand Down Expand Up @@ -116,4 +122,7 @@ export interface ScoutReportEvent {
test_run: ScoutTestRunInfo;
suite?: ScoutSuiteInfo;
test?: ScoutTestInfo;
process?: {
uptime?: number;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const reporterMappings: ClusterPutComponentTemplateRequest = {

export const testRunMappings: ClusterPutComponentTemplateRequest = {
name: 'scout-test-event.mappings.test-run',
version: 3,
version: 4,
template: {
mappings: {
properties: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,23 @@ export const testRunProperties: Record<PropertyName, MappingProperty> = {
duration: {
type: 'long',
},
tests: {
type: 'object',
properties: {
passes: {
type: 'long',
},
failures: {
type: 'long',
},
pending: {
type: 'long',
},
total: {
type: 'long',
},
},
},
config: {
type: 'object',
properties: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ export class ScoutFTRReporter {
/**
* Root suite execution has ended
*/
const passes = this.runner.stats?.passes ?? 0;
const failures = this.runner.stats?.failures ?? 0;
const pending = this.runner.stats?.pending ?? 0;

this.report.logEvent({
...datasources.environmentMetadata,
reporter: {
Expand All @@ -211,10 +215,19 @@ export class ScoutFTRReporter {
...this.baseTestRunInfo,
status: this.runner.stats?.failures === 0 ? 'passed' : 'failed',
duration: this.runner.stats?.duration || 0,
tests: {
passes,
failures,
pending,
total: passes + failures + pending,
},
},
event: {
action: ScoutReportEventAction.RUN_END,
},
process: {
uptime: Math.floor(process.uptime() * 1000),
},
});

// Save & conclude the report
Expand Down