Skip to content

Commit 36aa32a

Browse files
authored
Tserv 1525 update error message (#92)
* TSERV-1525 - add printing function * TSERV-1525 - fix printErrors function
1 parent beed8a0 commit 36aa32a

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

bin/run_functions.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,33 @@ function getQueryStringFromOptions(options) {
219219
return queryString;
220220
}
221221

222+
function printErrors(testjobId) {
223+
let endPoint = config.server + '/api/v1/testjobs';
224+
const url = endPoint + '/' + testjobId + '/report';
225+
request.get(url)
226+
.auth(config.username, config.password)
227+
.accept('application/json')
228+
.send()
229+
.end((err, res) => {
230+
const message = [];
231+
232+
const testSuiteResultReports = res.body.testSuiteResultReports;
233+
for (const testSuiteResultReport of testSuiteResultReports) {
234+
const testCaseResultReports = testSuiteResultReport.testCaseResultReports;
235+
for (const testCaseResultReport of testCaseResultReports) {
236+
const testStepResultReports = testCaseResultReport.testStepResultReports;
237+
for (const testStepResultReport of testStepResultReports) {
238+
const stepMessages = testStepResultReport.messages;
239+
message.push(...stepMessages);
240+
}
241+
}
242+
}
243+
if (message.toString() !== "") {
244+
util.output("Error: " + message);
245+
}
246+
});
247+
}
248+
222249
function executeProject(filename, project, options) {
223250
let projectFile = null;
224251
let isZipFile = false;
@@ -496,6 +523,7 @@ function executeProject(filename, project, options) {
496523
process.exitCode = 1;
497524
}
498525
}
526+
printErrors(jobId);
499527
jobId = null;
500528
}
501529
}

0 commit comments

Comments
 (0)