mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
RegTest : Add support for execution of a subset of tests
This commit is contained in:
parent
bb549c6aed
commit
58cd4d112a
@ -1901,7 +1901,7 @@ void logInfoTextWithTimeInSeconds(const QTime& time, const QString& msg)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiaApplication::runRegressionTest(const QString& testRootPath)
|
void RiaApplication::runRegressionTest(const QString& testRootPath, QStringList* testFilter)
|
||||||
{
|
{
|
||||||
m_runningRegressionTests = true;
|
m_runningRegressionTests = true;
|
||||||
|
|
||||||
@ -1921,6 +1921,28 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
|
|||||||
|
|
||||||
QFileInfoList folderList = testDir.entryInfoList();
|
QFileInfoList folderList = testDir.entryInfoList();
|
||||||
|
|
||||||
|
if (testFilter && testFilter->size() > 0)
|
||||||
|
{
|
||||||
|
QFileInfoList subset;
|
||||||
|
|
||||||
|
for (auto fi : folderList)
|
||||||
|
{
|
||||||
|
QString path = fi.path();
|
||||||
|
QString baseName = fi.baseName();
|
||||||
|
|
||||||
|
for (auto s : *testFilter)
|
||||||
|
{
|
||||||
|
QString trimmed = s.trimmed();
|
||||||
|
if (baseName.contains(trimmed))
|
||||||
|
{
|
||||||
|
subset.push_back(fi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
folderList = subset;
|
||||||
|
}
|
||||||
|
|
||||||
// delete diff and generated images
|
// delete diff and generated images
|
||||||
|
|
||||||
|
|
||||||
@ -2416,7 +2438,7 @@ bool RiaApplication::isRunningRegressionTests() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiaApplication::executeRegressionTests(const QString& regressionTestPath)
|
void RiaApplication::executeRegressionTests(const QString& regressionTestPath, QStringList* testFilter)
|
||||||
{
|
{
|
||||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||||
if (mainWnd)
|
if (mainWnd)
|
||||||
@ -2424,7 +2446,7 @@ void RiaApplication::executeRegressionTests(const QString& regressionTestPath)
|
|||||||
mainWnd->hideAllDockWindows();
|
mainWnd->hideAllDockWindows();
|
||||||
|
|
||||||
mainWnd->setDefaultWindowSize();
|
mainWnd->setDefaultWindowSize();
|
||||||
runRegressionTest(regressionTestPath);
|
runRegressionTest(regressionTestPath, testFilter);
|
||||||
|
|
||||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ public:
|
|||||||
int parseArgumentsAndRunUnitTestsIfRequested();
|
int parseArgumentsAndRunUnitTestsIfRequested();
|
||||||
bool parseArguments();
|
bool parseArguments();
|
||||||
|
|
||||||
void executeRegressionTests(const QString& regressionTestPath);
|
void executeRegressionTests(const QString& regressionTestPath, QStringList* testFilter = nullptr);
|
||||||
|
|
||||||
void setActiveReservoirView(RimView*);
|
void setActiveReservoirView(RimView*);
|
||||||
RimView* activeReservoirView();
|
RimView* activeReservoirView();
|
||||||
@ -141,7 +141,7 @@ public:
|
|||||||
void addWellLogsToModel(const QList<QString>& wellLogFilePaths);
|
void addWellLogsToModel(const QList<QString>& wellLogFilePaths);
|
||||||
|
|
||||||
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName);
|
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName);
|
||||||
void runRegressionTest(const QString& testRootPath);
|
void runRegressionTest(const QString& testRootPath, QStringList* testFilter = nullptr);
|
||||||
|
|
||||||
void processNonGuiEvents();
|
void processNonGuiEvents();
|
||||||
|
|
||||||
|
@ -17,7 +17,9 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "RiaRegressionTest.h"
|
#include "RiaRegressionTest.h"
|
||||||
|
|
||||||
#include "cafPdmUiFilePathEditor.h"
|
#include "cafPdmUiFilePathEditor.h"
|
||||||
|
#include "cafPdmUiTextEditor.h"
|
||||||
|
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RiaRegressionTest, "RiaRegressionTest");
|
CAF_PDM_SOURCE_INIT(RiaRegressionTest, "RiaRegressionTest");
|
||||||
@ -30,10 +32,11 @@ RiaRegressionTest::RiaRegressionTest(void)
|
|||||||
CAF_PDM_InitFieldNoDefault(&applicationWorkingFolder, "workingFolder", "Folder containing <b>compare</b>", "", "Location of compare tool from Image Magic suite", "");
|
CAF_PDM_InitFieldNoDefault(&applicationWorkingFolder, "workingFolder", "Folder containing <b>compare</b>", "", "Location of compare tool from Image Magic suite", "");
|
||||||
applicationWorkingFolder.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
applicationWorkingFolder.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(®ressionTestFolder, "regressionTestFolder", "Regression Test Folder", "", "", "");
|
CAF_PDM_InitFieldNoDefault(®ressionTestFolder, "regressionTestFolder", "Regression Test Folder", "", "", "");
|
||||||
regressionTestFolder.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
|
||||||
|
|
||||||
CAF_PDM_InitField(&showInteractiveDiffImages, "showInteractiveDiffImages", false, "Interactive diff images", "", "", "");
|
CAF_PDM_InitField(&showInteractiveDiffImages, "showInteractiveDiffImages", false, "Interactive diff images", "", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&testFilter, "testFilter", "Test Filter", "", "If empty, all tests are executed.\nTo execute a subset of tests, specify folder names separated by ;", "");
|
||||||
|
testFilter.uiCapability()->setUiEditorTypeName(caf::PdmUiTextEditor::uiEditorTypeName());
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -35,10 +35,9 @@ public:
|
|||||||
public:
|
public:
|
||||||
caf::PdmField<QString> applicationWorkingFolder;
|
caf::PdmField<QString> applicationWorkingFolder;
|
||||||
caf::PdmField<QString> regressionTestFolder;
|
caf::PdmField<QString> regressionTestFolder;
|
||||||
|
caf::PdmField<QString> testFilter;
|
||||||
caf::PdmField<bool> showInteractiveDiffImages;
|
caf::PdmField<bool> showInteractiveDiffImages;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1587,7 +1587,7 @@ void RiuMainWindow::slotShowRegressionTestDialog()
|
|||||||
caf::PdmSettings::readFieldsFromApplicationStore(®TestConfig);
|
caf::PdmSettings::readFieldsFromApplicationStore(®TestConfig);
|
||||||
|
|
||||||
caf::PdmUiPropertyViewDialog regressionTestDialog(this, ®TestConfig, "Regression Test", "");
|
caf::PdmUiPropertyViewDialog regressionTestDialog(this, ®TestConfig, "Regression Test", "");
|
||||||
regressionTestDialog.resize(QSize(600, 200));
|
regressionTestDialog.resize(QSize(600, 300));
|
||||||
|
|
||||||
if (regressionTestDialog.exec() == QDialog::Accepted)
|
if (regressionTestDialog.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
@ -1597,7 +1597,10 @@ void RiuMainWindow::slotShowRegressionTestDialog()
|
|||||||
QString currentApplicationPath = QDir::currentPath();
|
QString currentApplicationPath = QDir::currentPath();
|
||||||
|
|
||||||
QDir::setCurrent(regTestConfig.applicationWorkingFolder);
|
QDir::setCurrent(regTestConfig.applicationWorkingFolder);
|
||||||
app->executeRegressionTests(regTestConfig.regressionTestFolder);
|
|
||||||
|
QStringList testFilter = regTestConfig.testFilter().split(";", QString::SkipEmptyParts);
|
||||||
|
|
||||||
|
app->executeRegressionTests(regTestConfig.regressionTestFolder, &testFilter);
|
||||||
|
|
||||||
QDir::setCurrent(currentApplicationPath);
|
QDir::setCurrent(currentApplicationPath);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user