From 5d0dcbbc217d16175cbf06822c66406361762e05 Mon Sep 17 00:00:00 2001 From: Daniel Patterson Date: Tue, 6 Feb 2018 21:35:12 -0800 Subject: [PATCH] Show all test metadata in results --- features/support/shared_steps.js | 24 ++++++++++-------------- scripts/tests2doc.js | 20 ++++++++++++++++---- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/features/support/shared_steps.js b/features/support/shared_steps.js index 253be94fd..d6b55b188 100644 --- a/features/support/shared_steps.js +++ b/features/support/shared_steps.js @@ -81,20 +81,6 @@ module.exports = function () { approaches = this.approachList(route); - var resultdata = { - feature: this.feature.getName(), - scenario: this.scenario.getName(), - row: rowIndex, - expected: { - route: table.hashes()[rowIndex]["route"], - turns: table.hashes()[rowIndex]["turns"], - }, - got: { - route: instructions, - turns: turns - } - } - fs.writeFileSync(`${this.scenarioCacheFile}_${rowIndex}_results.json`,JSON.stringify(resultdata)); fs.writeFileSync(`${this.scenarioCacheFile}_${rowIndex}_response.json`,body); var geojson = { @@ -268,6 +254,16 @@ module.exports = function () { putValue('driving_side', driving_sides); } + var resultdata = { + feature: this.feature.getName(), + scenario: this.scenario.getName(), + row: rowIndex, + expected: table.hashes()[rowIndex], + got: got + } + console.log(resultdata); + fs.writeFileSync(`${this.scenarioCacheFile}_${rowIndex}_results.json`,JSON.stringify(resultdata)); + for (var key in row) { if (this.FuzzyMatch.match(got[key], row[key])) { got[key] = row[key]; diff --git a/scripts/tests2doc.js b/scripts/tests2doc.js index 6cfb6d027..b6f859207 100644 --- a/scripts/tests2doc.js +++ b/scripts/tests2doc.js @@ -179,7 +179,7 @@ find('test/cache').filter((f) => f.match(/[0-9]+_results.json$/)).forEach((f) => results.got.turns = results.got.turns.replace(/slight /g,'').replace(/sharp /g, ''); report += `
-

${results.feature} - ${results.scenario}

+

[link] ${results.feature} - ${results.scenario}

Download OSM XML file for this test
Download OSM PBF file for this test
Download request used for this test
@@ -192,9 +192,21 @@ find('test/cache').filter((f) => f.match(/[0-9]+_results.json$/)).forEach((f) => - - - + `; +}); +report += ``; +report += ``; +Object.keys(results.expected).forEach((k) => { + report += ``; +}); +report += ``; +report += ``; +Object.keys(results.expected).forEach((k) => { + report += ``; +}); +report += `
RouteTurns
OSRM${results.expected.route}${results.expected.turns}
Valhalla${results.got.route}${results.got.turns}
`; +Object.keys(results.expected).forEach((k) => { + report += `${k}
OSRM${results.expected[k]}
Valhalla${results.got[k]}