Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: improve the collecting information about failed tests #632

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 7 additions & 0 deletions qase-cucumberjs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [email protected]

## What's new

Improve the collecting information about failed tests.
Now, the reporter will collect the stack trace and the error message from all errors for failed tests.

# [email protected]

## What's new
Expand Down
2 changes: 1 addition & 1 deletion qase-cucumberjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cucumberjs-qase-reporter",
"version": "2.0.0",
"version": "2.0.1",
"description": "Qase TMS CucumberJS Reporter",
"homepage": "https://github.com/qase-tms/qase-javascript",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion qase-cucumberjs/src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export class Storage {
start_time: null,
end_time: null,
duration: Math.abs(testCase.timestamp.seconds - tcs.timestamp.seconds),
stacktrace: error?.stack ?? null,
stacktrace: error?.message ?? null,
thread: null,
},
fields: metadata.fields,
Expand Down
7 changes: 7 additions & 0 deletions qase-cypress/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [email protected]

## What's new

Improve the collecting information about failed tests.
Now, the reporter will collect the stack trace and the error message from all errors for failed tests.

# [email protected]

## What's new
Expand Down
2 changes: 1 addition & 1 deletion qase-cypress/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cypress-qase-reporter",
"version": "2.0.2",
"version": "2.0.3",
"description": "Qase Cypress Reporter",
"homepage": "https://github.com/qase-tms/qase-javascript",
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion qase-cypress/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class CypressQaseReporter extends reporters.Base {
attachments: attachments ?? [],
author: null,
fields: {},
message: test.err?.message ?? null,
message: null,
muted: false,
params: {},
relations: relations,
Expand Down
7 changes: 7 additions & 0 deletions qase-jest/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [email protected]

## What's new

Improve the collecting information about failed tests.
Now, the reporter will collect the stack trace and the error message from all errors for failed tests.

# [email protected]

## What's new
Expand Down
2 changes: 1 addition & 1 deletion qase-jest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-qase-reporter",
"version": "2.0.1",
"version": "2.0.2",
"description": "Qase TMS Jest Reporter",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion qase-jest/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
* @see {Reporter.onRunStart}
*/
public onRunStart() {
void this.reporter.startTestRun();

Check warning on line 86 in qase-jest/src/reporter.ts

View workflow job for this annotation

GitHub Actions / Project qase-jest - Node 16

void operator shouldn't be used on void; it should convey that a return value is being ignored

Check warning on line 86 in qase-jest/src/reporter.ts

View workflow job for this annotation

GitHub Actions / Project qase-jest - Node 18

void operator shouldn't be used on void; it should convey that a return value is being ignored
}

/**
Expand Down Expand Up @@ -130,7 +130,7 @@
thread: null,
},
fields: {},
message: error?.message ?? null,
message: null,
muted: false,
params: {},
relations: this.getRelations(filePath, ancestorTitles),
Expand Down
7 changes: 7 additions & 0 deletions qase-newman/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [email protected]

## What's new

Improve the collecting information about failed tests.
Now, the reporter will collect the stack trace and the error message from all errors for failed tests.

# [email protected]

## What's new
Expand Down
2 changes: 1 addition & 1 deletion qase-newman/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "newman-reporter-qase",
"version": "2.0.0",
"version": "2.0.1",
"description": "Qase TMS Newman Reporter",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
1 change: 0 additions & 1 deletion qase-newman/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ export class NewmanQaseReporter {

pendingResult.execution.status = TestStatusEnum.failed;
pendingResult.execution.stacktrace = err.stack ?? null;
pendingResult.message = err.message;
}
},
);
Expand Down
31 changes: 5 additions & 26 deletions qase-playwright/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,28 +211,19 @@ export class PlaywrightQaseReporter implements Reporter {

/**
* @param {TestError[]} testErrors
* @returns {Error}
* @returns {string}
* @private
*/
private static transformError(testErrors: TestError[]): Error {

private static transformError(testErrors: TestError[]): string {
let message = '';
for (const error of testErrors) {
if (error.message == undefined) {
continue;
}
message += error.message + '\n\n';
}

const error = new Error(message);
for (const error of testErrors) {
if (error.stack == undefined) {
continue;
}
error.stack += error.stack + '\n\n';
message += error.stack + '\n\n';
}

return error;
return message;
}

/**
Expand Down Expand Up @@ -339,16 +330,6 @@ export class PlaywrightQaseReporter implements Reporter {
message = testCaseMetadata.comment;
}

if (error) {
if (message) {
message += '\n\n';
} else {
message = '';
}

message += error.message;
}

const testResult: TestResultType = {
attachments: testCaseMetadata.attachments,
author: null,
Expand All @@ -357,9 +338,7 @@ export class PlaywrightQaseReporter implements Reporter {
start_time: result.startTime.valueOf() / 1000,
end_time: null,
duration: result.duration,
stacktrace: error === null ?
null : error.stack === undefined ?
null : error.stack,
stacktrace: error,
thread: result.parallelIndex.toString(),
},
fields: testCaseMetadata.fields,
Expand Down
7 changes: 7 additions & 0 deletions qase-testcafe/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [email protected]

## What's new

Improve the collecting information about failed tests.
Now, the reporter will collect the stack trace and the error message from all errors for failed tests.

# [email protected]

## What's new
Expand Down
2 changes: 1 addition & 1 deletion qase-testcafe/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "testcafe-reporter-qase",
"version": "2.0.0",
"version": "2.0.1",
"description": "Qase TMS TestCafe Reporter",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
14 changes: 5 additions & 9 deletions qase-testcafe/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ export class TestcafeQaseReporter {

/**
* @param {TestRunErrorFormattableAdapterType[]} errors
* @returns {Error}
* @returns {string}
* @private
*/
private static transformErrors(errors: TestRunErrorFormattableAdapterType[]): Error {
private static transformErrors(errors: TestRunErrorFormattableAdapterType[]): string {
const [errorMessages, errorStacks] = errors.reduce<[string[], string[]]>(
([messages, stacks], error) => {
const stack =
Expand All @@ -113,11 +113,7 @@ export class TestcafeQaseReporter {
[[], []],
);

const error = new Error(errorMessages.join('\n\n'));

error.stack = errorStacks.join('\n\n');

return error;
return errorMessages.join('\n\n') + '\n\n' + errorStacks.join('\n\n');
}

/**
Expand Down Expand Up @@ -192,11 +188,11 @@ export class TestcafeQaseReporter {
start_time: null,
end_time: null,
duration: testRunInfo.durationMs,
stacktrace: error.stack ?? null,
stacktrace: error,
thread: null,
},
fields: metadata[metadataEnum.fields],
message: error.message,
message: null,
muted: false,
params: metadata[metadataEnum.parameters],
relations: {
Expand Down
Loading