Added date/time to testResultsFolder.

This commit is contained in:
NissimHadar 2018-03-09 18:13:26 -08:00
parent 77901e5089
commit 84cc4c18a4
2 changed files with 11 additions and 18 deletions

View file

@ -31,21 +31,13 @@ Test::Test() {
mismatchWindow.setModal(true); mismatchWindow.setModal(true);
} }
bool Test::createTestResultsFolderPathIfNeeded(QString directory) { bool Test::createTestResultsFolderPath(QString directory) {
// The test results folder is located in the root of the tests (i.e. for recursive test evaluation) QDateTime now = QDateTime::currentDateTime();
if (testResultsFolderPath == "") { testResultsFolderPath = directory + "/" + TEST_RESULTS_FOLDER + "--" + now.toString(DATETIME_FORMAT);
testResultsFolderPath = directory + "/" + TEST_RESULTS_FOLDER;
QDir testResultsFolder(testResultsFolderPath); QDir testResultsFolder(testResultsFolderPath);
if (testResultsFolder.exists()) {
testResultsFolder.removeRecursively();
}
// Create a new test results folder // Create a new test results folder
return QDir().mkdir(testResultsFolderPath); return QDir().mkdir(testResultsFolderPath);
} else {
return true;
}
} }
void Test::zipAndDeleteTestResultsFolder() { void Test::zipAndDeleteTestResultsFolder() {
@ -194,7 +186,7 @@ void Test::startTestsEvaluation() {
} }
// Quit if test results folder could not be created // Quit if test results folder could not be created
if (!createTestResultsFolderPathIfNeeded(pathToTestResultsDirectory)) { if (!createTestResultsFolderPath(pathToTestResultsDirectory)) {
return; return;
} }

View file

@ -43,7 +43,7 @@ public:
void appendTestResultsToFile(QString testResultsFolderPath, TestFailure testFailure, QPixmap comparisonImage); void appendTestResultsToFile(QString testResultsFolderPath, TestFailure testFailure, QPixmap comparisonImage);
bool createTestResultsFolderPathIfNeeded(QString directory); bool createTestResultsFolderPath(QString directory);
void zipAndDeleteTestResultsFolder(); void zipAndDeleteTestResultsFolder();
bool isAValidDirectory(QString pathname); bool isAValidDirectory(QString pathname);
@ -83,6 +83,7 @@ private:
// Used for accessing GitHub // Used for accessing GitHub
const QString user { "NissimHadar" }; const QString user { "NissimHadar" };
const QString branch { "addRecursionToAutotester" }; const QString branch { "addRecursionToAutotester" };
const QString DATETIME_FORMAT { "yyyy-MM-dd_hh-mm-ss" };
}; };
#endif // hifi_test_h #endif // hifi_test_h