Regression Test : Allow execution of tests starting at filter folder

This commit is contained in:
Magne Sjaastad
2019-04-24 08:06:13 +02:00
parent 5123d5d0c5
commit 6dd3b36f86
5 changed files with 16 additions and 2 deletions

View File

@@ -70,6 +70,9 @@ RiaRegressionTest::RiaRegressionTest(void)
"If empty, all tests are executed.\nTo execute a subset of tests, specify folder names separated by ;",
"");
testFilter.uiCapability()->setUiEditorTypeName(caf::PdmUiTextEditor::uiEditorTypeName());
CAF_PDM_InitField(
&appendTestsAfterTestFilter, "appendTestsAfterTestFilter", false, "Append All Tests After Test Filter", "", "", "");
}
//--------------------------------------------------------------------------------------------------

View File

@@ -42,6 +42,7 @@ public:
caf::PdmField<bool> showInteractiveDiffImages;
caf::PdmField<bool> useOpenMPForGeometryCreation;
caf::PdmField<bool> openReportInBrowser;
caf::PdmField<bool> appendTestsAfterTestFilter;
protected:
void defineEditorAttribute(const caf::PdmFieldHandle* field,

View File

@@ -83,6 +83,7 @@ void logInfoTextWithTimeInSeconds(const QTime& time, const QString& msg)
//--------------------------------------------------------------------------------------------------
RiaRegressionTestRunner::RiaRegressionTestRunner()
: m_runningRegressionTests(false)
, m_appendAllTestsAfterLastItemInFilter(false)
{
}
@@ -589,6 +590,8 @@ QFileInfoList RiaRegressionTestRunner::subDirectoriesForTestExecution(const QDir
return folderList;
}
bool anyMatchFound = false;
QFileInfoList foldersMatchingTestFilter;
QFileInfoList folderList = directory.entryInfoList();
@@ -600,9 +603,10 @@ QFileInfoList RiaRegressionTestRunner::subDirectoriesForTestExecution(const QDir
for (const auto& s : m_testFilter)
{
QString trimmed = s.trimmed();
if (baseName.contains(trimmed, Qt::CaseInsensitive))
if (anyMatchFound || baseName.contains(trimmed, Qt::CaseInsensitive))
{
foldersMatchingTestFilter.push_back(fi);
anyMatchFound = true;
}
}
}
@@ -621,6 +625,11 @@ void RiaRegressionTestRunner::executeRegressionTests()
QString testPath = testConfig.regressionTestFolder();
QStringList testFilter = testConfig.testFilter().split(";", QString::SkipEmptyParts);
if (testConfig.appendTestsAfterTestFilter)
{
m_appendAllTestsAfterLastItemInFilter = true;
}
executeRegressionTests(testPath, testFilter);
}

View File

@@ -68,6 +68,7 @@ private:
private:
QString m_rootPath;
QStringList m_testFilter;
bool m_appendAllTestsAfterLastItemInFilter;
bool m_runningRegressionTests;
RiaRegressionTest m_regressionTestSettings;
};

View File

@@ -1903,7 +1903,7 @@ void RiuMainWindow::slotShowRegressionTestDialog()
regTestConfig.readSettingsFromApplicationStore();
caf::PdmUiPropertyViewDialog regressionTestDialog(this, &regTestConfig, "Regression Test", "");
regressionTestDialog.resize(QSize(600, 300));
regressionTestDialog.resize(QSize(600, 350));
if (regressionTestDialog.exec() == QDialog::Accepted)
{