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

finish step undefined status #94

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion __tests__/reporter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ describe('reporter', () => {
test('should call client.finishTestItem with correct parameters', () => {
reporter.finishSuite();

expect(reporter.client.finishTestItem).toHaveBeenCalledWith('parentId', {});
expect(reporter.client.finishTestItem).toHaveBeenCalledWith('parentId', { "status": "PASSED", });
});
});
});
17 changes: 16 additions & 1 deletion lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,27 @@ class Reporter {
.promise.catch(errorHandler);
}

finishUndefinedStep() {
for (const item of this.collectionMap.values()) {
for (const step of item.steps) {
if (step.status === undefined) {
let finishTestItemRQ = {
endTime: new Date().valueOf(),
status: 'SKIPPED'
dgosantos89 marked this conversation as resolved.
Show resolved Hide resolved
};
this.client.finishTestItem(step.stepId, finishTestItemRQ);
}
}
}
}

// Finishes suite
onBeforeDone (err) {
if (err) {
throw err;
}

this.finishUndefinedStep();
this.finishSuite();
this.suitesInfoStack.pop();
}
Expand Down Expand Up @@ -441,7 +456,7 @@ class Reporter {
finishSuite () {
const currentSuiteTempId = this.getCurrentSuiteTempId();
const status = this.collectionRunOptions.collection &&
utils.getCollectionVariablesByKey('status', this.collectionRunOptions.collection.variables);
utils.getCollectionVariablesByKey('status', this.collectionRunOptions.collection.variables) || 'PASSED';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ReportPortal API will calculate the final suite status based on the statuses of its descendants, so setting here PASSED as a fallback may lead to wrong suite status in the system.


this.client
.finishTestItem(currentSuiteTempId, { status })
Expand Down