diff --git a/tools/auto-tester/src/TestRunner.cpp b/tools/auto-tester/src/TestRunner.cpp index e40e9a0986..dddc30e8a8 100644 --- a/tools/auto-tester/src/TestRunner.cpp +++ b/tools/auto-tester/src/TestRunner.cpp @@ -56,6 +56,7 @@ void TestRunner::setWorkingFolder() { } _installationFolder = _workingFolder + "/High Fidelity"; + _logFile.setFileName(_workingFolder + "/log.txt"); autoTester->enableRunTabControls(); _workingFolderLabel->setText(QDir::toNativeSeparators(_workingFolder)); @@ -67,6 +68,7 @@ void TestRunner::setWorkingFolder() { } void TestRunner::run() { + _testStartDateTime = QDateTime::currentDateTime(); _automatedTestIsRunning = true; // Initial setup @@ -83,12 +85,20 @@ void TestRunner::run() { QStringList filenames; filenames << INSTALLER_FILENAME << BUILD_XML_FILENAME; + updateStatusLabel("Downloading installer"); + autoTester->downloadFiles(urls, _workingFolder, filenames, (void*)this); // `installerDownloadComplete` will run after download has completed } void TestRunner::installerDownloadComplete() { + appendLog(QString("Test started at ") + QString::number(_testStartDateTime.time().hour()) + ":" + + QString("%1").arg(_testStartDateTime.time().minute(), 2, 10, QChar('0')) + ", on " + + _testStartDateTime.date().toString("ddd, MMM d, yyyy")); + + updateStatusLabel("Installing"); + // Kill any existing processes that would interfere with installation killProcesses(); @@ -96,6 +106,8 @@ void TestRunner::installerDownloadComplete() { createSnapshotFolder(); + updateStatusLabel("Running tests"); + startLocalServerProcesses(); runInterfaceWithTestScript(); killProcesses(); @@ -232,6 +244,7 @@ void TestRunner::runInterfaceWithTestScript() { } void TestRunner::evaluateResults() { + updateStatusLabel("Evaluating results"); autoTester->startTestsEvaluation(false, true, _snapshotFolder, _branch, _user); } @@ -239,6 +252,7 @@ void TestRunner::automaticTestRunEvaluationComplete(QString zippedFolder) { addBuildNumberToResults(zippedFolder); restoreHighFidelityAppDataFolder(); + updateStatusLabel("Testing complete"); _automatedTestIsRunning = false; } @@ -382,4 +396,22 @@ void TestRunner::checkTime() { if (timeToRun) { run(); } +} + +void TestRunner::updateStatusLabel(const QString& message) { + autoTester->updateStatusLabel(message); +} + +void TestRunner::appendLog(const QString& message) { + if (!_logFile.open(QIODevice::Append | QIODevice::Text)) { + QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), + "Could not open the log file"); + exit(-1); + } + + _logFile.write(message.toStdString().c_str()); + _logFile.write("\n"); + _logFile.close(); + + autoTester->appendLogWindow(message); } \ No newline at end of file diff --git a/tools/auto-tester/src/TestRunner.h b/tools/auto-tester/src/TestRunner.h index 605d56c88d..e13b0be070 100644 --- a/tools/auto-tester/src/TestRunner.h +++ b/tools/auto-tester/src/TestRunner.h @@ -51,6 +51,9 @@ public: void copyFolder(const QString& source, const QString& destination); + void updateStatusLabel(const QString& message); + void appendLog(const QString& message); + private slots: void checkTime(); @@ -85,6 +88,10 @@ private: QLabel* _workingFolderLabel; QTimer* _timer; + + QFile _logFile; + + QDateTime _testStartDateTime; }; #endif // hifi_testRunner_h \ No newline at end of file diff --git a/tools/auto-tester/src/ui/AutoTester.cpp b/tools/auto-tester/src/ui/AutoTester.cpp index 951ee1acd7..05eee2957a 100644 --- a/tools/auto-tester/src/ui/AutoTester.cpp +++ b/tools/auto-tester/src/ui/AutoTester.cpp @@ -32,7 +32,11 @@ AutoTester::AutoTester(QWidget* parent) : QMainWindow(parent) { #ifndef Q_OS_WIN _ui.tabWidget->removeTab(1); #endif - //// Coming soon to an auto-tester near you... + + _ui.statusLabel->setText(""); + _ui.plainTextEdit->setReadOnly(true); + + // Coming soon to an auto-tester near you... //// _helpWindow.textBrowser->setText() } @@ -67,7 +71,8 @@ void AutoTester::startTestsEvaluation(const bool isRunningFromCommandLine, const bool isRunningInAutomaticTestRun, const QString& snapshotDirectory, const QString& branch, - const QString& user) { + const QString& user +) { _test->startTestsEvaluation(isRunningFromCommandLine, isRunningInAutomaticTestRun, snapshotDirectory, branch, user); } @@ -263,3 +268,11 @@ void AutoTester::setBranchText(const QString& branch) { QString AutoTester::getSelectedBranch() { return _ui.branchTextEdit->toPlainText(); } + +void AutoTester::updateStatusLabel(const QString& status) { + _ui.statusLabel->setText(status); +} + +void AutoTester::appendLogWindow(const QString& message) { + _ui.plainTextEdit->appendPlainText(message); +} \ No newline at end of file diff --git a/tools/auto-tester/src/ui/AutoTester.h b/tools/auto-tester/src/ui/AutoTester.h index 8ef238d953..de0622c670 100644 --- a/tools/auto-tester/src/ui/AutoTester.h +++ b/tools/auto-tester/src/ui/AutoTester.h @@ -49,6 +49,9 @@ public: void enableRunTabControls(); + void updateStatusLabel(const QString& status); + void appendLogWindow(const QString& message); + private slots: void on_tabWidget_currentChanged(int index); diff --git a/tools/auto-tester/src/ui/AutoTester.ui b/tools/auto-tester/src/ui/AutoTester.ui index bc8fa27af6..fa9569a768 100644 --- a/tools/auto-tester/src/ui/AutoTester.ui +++ b/tools/auto-tester/src/ui/AutoTester.ui @@ -6,8 +6,8 @@ 0 0 - 582 - 734 + 707 + 796 @@ -23,8 +23,8 @@ - 430 - 620 + 470 + 660 100 40 @@ -38,8 +38,8 @@ 30 140 - 521 - 461 + 631 + 501 @@ -320,7 +320,7 @@ 130 150 - 181 + 161 191 @@ -446,6 +446,42 @@ ####### + + + + 300 + 120 + 311 + 331 + + + + + + + 300 + 80 + 41 + 31 + + + + Status: + + + + + + 350 + 80 + 271 + 31 + + + + ####### + + @@ -615,7 +651,7 @@ 80 - 630 + 670 255 23 @@ -630,7 +666,7 @@ 0 0 - 582 + 707 21