This commit is contained in:
NissimHadar 2018-09-12 17:37:02 -07:00
parent 8ee051ea14
commit cbc53f1e5d
5 changed files with 102 additions and 11 deletions

View file

@ -56,6 +56,7 @@ void TestRunner::setWorkingFolder() {
} }
_installationFolder = _workingFolder + "/High Fidelity"; _installationFolder = _workingFolder + "/High Fidelity";
_logFile.setFileName(_workingFolder + "/log.txt");
autoTester->enableRunTabControls(); autoTester->enableRunTabControls();
_workingFolderLabel->setText(QDir::toNativeSeparators(_workingFolder)); _workingFolderLabel->setText(QDir::toNativeSeparators(_workingFolder));
@ -67,6 +68,7 @@ void TestRunner::setWorkingFolder() {
} }
void TestRunner::run() { void TestRunner::run() {
_testStartDateTime = QDateTime::currentDateTime();
_automatedTestIsRunning = true; _automatedTestIsRunning = true;
// Initial setup // Initial setup
@ -83,12 +85,20 @@ void TestRunner::run() {
QStringList filenames; QStringList filenames;
filenames << INSTALLER_FILENAME << BUILD_XML_FILENAME; filenames << INSTALLER_FILENAME << BUILD_XML_FILENAME;
updateStatusLabel("Downloading installer");
autoTester->downloadFiles(urls, _workingFolder, filenames, (void*)this); autoTester->downloadFiles(urls, _workingFolder, filenames, (void*)this);
// `installerDownloadComplete` will run after download has completed // `installerDownloadComplete` will run after download has completed
} }
void TestRunner::installerDownloadComplete() { 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 // Kill any existing processes that would interfere with installation
killProcesses(); killProcesses();
@ -96,6 +106,8 @@ void TestRunner::installerDownloadComplete() {
createSnapshotFolder(); createSnapshotFolder();
updateStatusLabel("Running tests");
startLocalServerProcesses(); startLocalServerProcesses();
runInterfaceWithTestScript(); runInterfaceWithTestScript();
killProcesses(); killProcesses();
@ -232,6 +244,7 @@ void TestRunner::runInterfaceWithTestScript() {
} }
void TestRunner::evaluateResults() { void TestRunner::evaluateResults() {
updateStatusLabel("Evaluating results");
autoTester->startTestsEvaluation(false, true, _snapshotFolder, _branch, _user); autoTester->startTestsEvaluation(false, true, _snapshotFolder, _branch, _user);
} }
@ -239,6 +252,7 @@ void TestRunner::automaticTestRunEvaluationComplete(QString zippedFolder) {
addBuildNumberToResults(zippedFolder); addBuildNumberToResults(zippedFolder);
restoreHighFidelityAppDataFolder(); restoreHighFidelityAppDataFolder();
updateStatusLabel("Testing complete");
_automatedTestIsRunning = false; _automatedTestIsRunning = false;
} }
@ -382,4 +396,22 @@ void TestRunner::checkTime() {
if (timeToRun) { if (timeToRun) {
run(); 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);
} }

View file

@ -51,6 +51,9 @@ public:
void copyFolder(const QString& source, const QString& destination); void copyFolder(const QString& source, const QString& destination);
void updateStatusLabel(const QString& message);
void appendLog(const QString& message);
private slots: private slots:
void checkTime(); void checkTime();
@ -85,6 +88,10 @@ private:
QLabel* _workingFolderLabel; QLabel* _workingFolderLabel;
QTimer* _timer; QTimer* _timer;
QFile _logFile;
QDateTime _testStartDateTime;
}; };
#endif // hifi_testRunner_h #endif // hifi_testRunner_h

View file

@ -32,7 +32,11 @@ AutoTester::AutoTester(QWidget* parent) : QMainWindow(parent) {
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
_ui.tabWidget->removeTab(1); _ui.tabWidget->removeTab(1);
#endif #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() //// _helpWindow.textBrowser->setText()
} }
@ -67,7 +71,8 @@ void AutoTester::startTestsEvaluation(const bool isRunningFromCommandLine,
const bool isRunningInAutomaticTestRun, const bool isRunningInAutomaticTestRun,
const QString& snapshotDirectory, const QString& snapshotDirectory,
const QString& branch, const QString& branch,
const QString& user) { const QString& user
) {
_test->startTestsEvaluation(isRunningFromCommandLine, isRunningInAutomaticTestRun, snapshotDirectory, branch, user); _test->startTestsEvaluation(isRunningFromCommandLine, isRunningInAutomaticTestRun, snapshotDirectory, branch, user);
} }
@ -263,3 +268,11 @@ void AutoTester::setBranchText(const QString& branch) {
QString AutoTester::getSelectedBranch() { QString AutoTester::getSelectedBranch() {
return _ui.branchTextEdit->toPlainText(); return _ui.branchTextEdit->toPlainText();
} }
void AutoTester::updateStatusLabel(const QString& status) {
_ui.statusLabel->setText(status);
}
void AutoTester::appendLogWindow(const QString& message) {
_ui.plainTextEdit->appendPlainText(message);
}

View file

@ -49,6 +49,9 @@ public:
void enableRunTabControls(); void enableRunTabControls();
void updateStatusLabel(const QString& status);
void appendLogWindow(const QString& message);
private slots: private slots:
void on_tabWidget_currentChanged(int index); void on_tabWidget_currentChanged(int index);

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>582</width> <width>707</width>
<height>734</height> <height>796</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -23,8 +23,8 @@
<widget class="QPushButton" name="closeButton"> <widget class="QPushButton" name="closeButton">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>430</x> <x>470</x>
<y>620</y> <y>660</y>
<width>100</width> <width>100</width>
<height>40</height> <height>40</height>
</rect> </rect>
@ -38,8 +38,8 @@
<rect> <rect>
<x>30</x> <x>30</x>
<y>140</y> <y>140</y>
<width>521</width> <width>631</width>
<height>461</height> <height>501</height>
</rect> </rect>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
@ -320,7 +320,7 @@
<rect> <rect>
<x>130</x> <x>130</x>
<y>150</y> <y>150</y>
<width>181</width> <width>161</width>
<height>191</height> <height>191</height>
</rect> </rect>
</property> </property>
@ -446,6 +446,42 @@
<string>#######</string> <string>#######</string>
</property> </property>
</widget> </widget>
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="geometry">
<rect>
<x>300</x>
<y>120</y>
<width>311</width>
<height>331</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="workingFolderLabel_2">
<property name="geometry">
<rect>
<x>300</x>
<y>80</y>
<width>41</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Status:</string>
</property>
</widget>
<widget class="QLabel" name="statusLabel">
<property name="geometry">
<rect>
<x>350</x>
<y>80</y>
<width>271</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>#######</string>
</property>
</widget>
</widget> </widget>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="tab_2">
<attribute name="title"> <attribute name="title">
@ -615,7 +651,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>80</x> <x>80</x>
<y>630</y> <y>670</y>
<width>255</width> <width>255</width>
<height>23</height> <height>23</height>
</rect> </rect>
@ -630,7 +666,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>582</width> <width>707</width>
<height>21</height> <height>21</height>
</rect> </rect>
</property> </property>