Regression tests : Add basic timing with reporting by logging

This commit is contained in:
Magne Sjaastad 2017-04-20 22:34:15 +02:00
parent 9d5fcaf5a1
commit ed2010c0b7

View File

@ -2259,6 +2259,18 @@ void removeDirectoryWithContent(QDir dirToDelete )
dirToDelete.rmdir(".");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void logInfoTextWithTimeInSeconds(const QTime& time, const QString& msg)
{
double timeRunning = time.elapsed() / 1000.0;
QString timeText = QString("(%1 s) ").arg(timeRunning, 0, 'f', 1);
RiaLogging::info(timeText + msg);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -2315,6 +2327,11 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
}
}
QTime timeStamp;
timeStamp.start();
logInfoTextWithTimeInSeconds(timeStamp, "Starting regression tests\n");
for (int dirIdx = 0; dirIdx < folderList.size(); ++dirIdx)
{
QDir testCaseFolder(folderList[dirIdx].filePath());
@ -2351,6 +2368,8 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
if (!projectFileName.isEmpty())
{
logInfoTextWithTimeInSeconds(timeStamp, "Initializing test :" + testCaseFolder.absolutePath());
loadProject(testCaseFolder.filePath(projectFileName));
// Wait until all command objects have completed
@ -2386,9 +2405,14 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
}
closeProject();
logInfoTextWithTimeInSeconds(timeStamp, "Completed test :" + testCaseFolder.absolutePath());
}
}
RiaLogging::info("\n");
logInfoTextWithTimeInSeconds(timeStamp, "Completed regression tests");
m_runningRegressionTests = false;
}