@@ -58,7 +58,7 @@ LoaderTests.prototype.runTest = function (testName, testidx){
5858 } )
5959}
6060
61- LoaderTests . prototype . getTestResults = async function ( testName , testidx , resultidx ) {
61+ LoaderTests . prototype . getTestResults = async function ( testName , testidx , resultidx , datetime ) {
6262 var testName = testName ;
6363 var resultidx = resultidx ;
6464 const config = {
@@ -71,7 +71,7 @@ LoaderTests.prototype.getTestResults = async function (testName, testidx, result
7171 await axios ( config )
7272 . then ( response => {
7373 response . data [ 'test_name' ] = testName ;
74- this . write2CSV ( ) ;
74+ this . write2CSV ( datetime ) ;
7575 this . _testResults . push ( response . data ) ;
7676 } )
7777 . catch ( error => {
@@ -80,8 +80,8 @@ LoaderTests.prototype.getTestResults = async function (testName, testidx, result
8080 } ) ;
8181}
8282
83- LoaderTests . prototype . write2CSV = async function ( ) {
84- const writeCSVStream = fs . createWriteStream ( 'results .csv' ) ;
83+ LoaderTests . prototype . write2CSV = async function ( datetime ) {
84+ const writeCSVStream = fs . createWriteStream ( `results_ ${ datetime } .csv` ) ;
8585 await converter . json2csv ( this . _testResults , ( err , csv ) => {
8686 if ( err ) {
8787 console . log ( 'Writing from json2csv has an error: ' , err ) ;
@@ -104,8 +104,9 @@ async function run() {
104104 }
105105 console . log ( 'All tests ran...' ) ;
106106 console . log ( 'Fetching data and writing to CSV file...' ) ;
107+ const datetime = Date . now ( ) ;
107108 await newRun . _testSuite . forEach ( value => {
108- newRun . getTestResults ( value . testName , value . testidx , value . resultidx )
109+ newRun . getTestResults ( value . testName , value . testidx , value . resultidx , datetime )
109110 } ) ;
110111 console . log ( 'results.csv file should be created / updated soon' ) ;
111112 } catch ( err ) {
0 commit comments