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

View file

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