1
0
Fork 0

Fix testresult (#10262)

This commit is contained in:
Wilfried Goesgens 2019-10-17 08:42:08 +02:00 committed by Jan
parent b16a5e6393
commit c8a2b554c6
2 changed files with 27 additions and 19 deletions

View File

@ -58,6 +58,7 @@ const internalMembers = [
'processStats', 'processStats',
'startupTime', 'startupTime',
'testDuration', 'testDuration',
'timeout',
'shutdownTime', 'shutdownTime',
'totalSetUp', 'totalSetUp',
'totalTearDown', 'totalTearDown',
@ -99,10 +100,6 @@ function gatherStatus(result) {
); );
} }
// //////////////////////////////////////////////////////////////////////////////
// / @brief pretty prints the result
// //////////////////////////////////////////////////////////////////////////////
function fancyTimeFormat(time) function fancyTimeFormat(time)
{ {
// Hours, minutes and seconds // Hours, minutes and seconds
@ -331,6 +328,10 @@ function saveToJunitXML(options, results) {
}); });
} }
// //////////////////////////////////////////////////////////////////////////////
// / @brief pretty prints the result
// //////////////////////////////////////////////////////////////////////////////
function unitTestPrettyPrintResults (options, results) { function unitTestPrettyPrintResults (options, results) {
let onlyFailedMessages = ''; let onlyFailedMessages = '';
let failedMessages = ''; let failedMessages = '';
@ -381,6 +382,7 @@ function unitTestPrettyPrintResults (options, results) {
failedCases[testSuiteName] = { failedCases[testSuiteName] = {
test: testCaseMessage(testSuite) test: testCaseMessage(testSuite)
}; };
failsOfOneSuite[testSuiteName + '_ALL'] = testCaseMessage(testSuite);
} }
} }
}, },
@ -511,6 +513,10 @@ ${failedMessages}${color} * Overall state: ${statusMessage}${RESET}${crashText}$
fs.write(options.testOutputDirectory + options.testFailureText, onlyFailedMessages); fs.write(options.testOutputDirectory + options.testFailureText, onlyFailedMessages);
} }
// //////////////////////////////////////////////////////////////////////////////
// / @brief creates a chartlist of the longest running tests
// //////////////////////////////////////////////////////////////////////////////
function locateLongRunning(options, results) { function locateLongRunning(options, results) {
let testRunStatistics = ""; let testRunStatistics = "";
let sortedByDuration = []; let sortedByDuration = [];
@ -608,6 +614,11 @@ function locateLongRunning(options, results) {
print(testRunStatistics); print(testRunStatistics);
} }
// //////////////////////////////////////////////////////////////////////////////
// / @brief creates a chart list of the tests with the most excessive
// setup/teardown usage
// //////////////////////////////////////////////////////////////////////////////
function locateLongSetupTeardown(options, results) { function locateLongSetupTeardown(options, results) {
let testRunStatistics = " Setup | Run | tests | setupAll | suite name\n"; let testRunStatistics = " Setup | Run | tests | setupAll | suite name\n";
let sortedByDuration = []; let sortedByDuration = [];
@ -702,7 +713,9 @@ function locateLongSetupTeardown(options, results) {
print(testRunStatistics); print(testRunStatistics);
} }
// //////////////////////////////////////////////////////////////////////////////
// / @brief prints the factor server startup/teardown vs. test duration
// //////////////////////////////////////////////////////////////////////////////
function locateShortServerLife(options, results) { function locateShortServerLife(options, results) {
let rc = true; let rc = true;

View File

@ -765,27 +765,22 @@ function readTestResult(path, rc, testCase) {
buf = fs.read(jsonFN); buf = fs.read(jsonFN);
fs.remove(jsonFN); fs.remove(jsonFN);
} catch (x) { } catch (x) {
let msg = 'failed to read ' + jsonFN + " - " + x; let msg = 'readTestResult: failed to read ' + jsonFN + " - " + x;
print(RED + msg + RESET); print(RED + msg + RESET);
return { rc.message += " - " + msg;
failed: 1, rc.status = false;
status: false, return rc;
message: msg,
duration: -1
};
} }
let result; let result;
try { try {
result = JSON.parse(buf); result = JSON.parse(buf);
} catch (x) { } catch (x) {
let msg = 'failed to parse ' + jsonFN + "'" + buf + "' - " + x; let msg = 'readTestResult: failed to parse ' + jsonFN + "'" + buf + "' - " + x;
print(RED + msg + RESET); print(RED + msg + RESET);
return { rc.message += " - " + msg;
status: false, rc.status = false;
message: msg, return rc;
duration: -1
};
} }
if (Array.isArray(result)) { if (Array.isArray(result)) {
@ -810,7 +805,7 @@ function readTestResult(path, rc, testCase) {
} }
} else { } else {
rc.failed = rc.status ? 0 : 1; rc.failed = rc.status ? 0 : 1;
rc.message = "don't know howto handle '" + buf + "'"; rc.message = "readTestResult: don't know howto handle '" + buf + "'";
return rc; return rc;
} }
} }