From c63ec596cba673fb3541213132e7929464b3116a Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Thu, 11 Feb 2016 09:43:43 +0100 Subject: [PATCH 1/3] added default for total --- UnitTests/unittest.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/UnitTests/unittest.js b/UnitTests/unittest.js index 3cde66d058..6b1c556430 100644 --- a/UnitTests/unittest.js +++ b/UnitTests/unittest.js @@ -86,6 +86,12 @@ function resultsToXml(results, baseName, cluster) { } let xml = buildXml(); + let total = 0; + + if (current.hasOwnProperty('total')) { + total = current.total; + } + let failuresFound = 0; if (current.hasOwnProperty('failed')) { @@ -95,8 +101,8 @@ function resultsToXml(results, baseName, cluster) { xml.elem("testsuite", { errors: 0, failures: failuresFound, + tests: total, name: clprefix + runName, - tests: current.total, time: current.duration }); From 7b3fc6d09fe3d3c029f8d688452fd582b80973f2 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Thu, 11 Feb 2016 12:12:44 +0100 Subject: [PATCH 2/3] use information from testresult.json --- js/client/modules/@arangodb/testing.js | 39 ++++++++++++++++++-------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/js/client/modules/@arangodb/testing.js b/js/client/modules/@arangodb/testing.js index 23305330bb..50e7f55331 100644 --- a/js/client/modules/@arangodb/testing.js +++ b/js/client/modules/@arangodb/testing.js @@ -176,20 +176,37 @@ const makeResults = function(testname) { return function(status, message) { let duration = time() - startTime; + let results; - let results = { - status: status, - duration: duration, - total: 1, - failed: status ? 0 : 1, - 'testing.js': { + if (status) { + let result; + + try { + result = JSON.parse(fs.read("testresult.json")); + + if ((typeof result[0] === 'object') && + result[0].hasOwnProperty('status')) { + results = result[0]; + } + + } catch (x) {} + } + + if (results === undefined) { + results = { status: status, - duration: duration - } - }; + duration: duration, + total: 1, + failed: status ? 0 : 1, + 'testing.js': { + status: status, + duration: duration + } + }; - if (message) { - results['testing.js'].message = message; + if (message) { + results['testing.js'].message = message; + } } let full = {}; From 812bfbb5ed0822025c25f4a89d2a1e8eea95876e Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Thu, 11 Feb 2016 12:30:31 +0100 Subject: [PATCH 3/3] added help on empty call --- js/client/modules/@arangodb/testing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/client/modules/@arangodb/testing.js b/js/client/modules/@arangodb/testing.js index 50e7f55331..b2f3ce0b95 100644 --- a/js/client/modules/@arangodb/testing.js +++ b/js/client/modules/@arangodb/testing.js @@ -3811,7 +3811,7 @@ function unitTest(cases, options) { _.defaults(options, optionsDefaults); - if (cases === undefined) { + if (cases === undefined || cases.length === 0) { printUsage(); print('FATAL: "which" is undefined\n');