#2577 Test : Add test toolbar to launch unit tests and regression tests

This commit is contained in:
Magne Sjaastad
2018-03-06 13:18:39 +01:00
parent ec96edf266
commit 2435e92be1
6 changed files with 110 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCloseProjectFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicHelpFeatures.h
${CMAKE_CURRENT_LIST_DIR}/RicEditPreferencesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotDataFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicLaunchRegressionTestsFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
@@ -29,6 +30,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCloseProjectFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicHelpFeatures.cpp
${CMAKE_CURRENT_LIST_DIR}/RicEditPreferencesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotDataFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicLaunchRegressionTestsFeature.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -0,0 +1,60 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicLaunchRegressionTestsFeature.h"
#include "RiaApplication.h"
#include "RiaRegressionTest.h"
#include "cafPdmSettings.h"
#include <QAction>
#include <QDir>
CAF_CMD_SOURCE_INIT(RicLaunchRegressionTestsFeature, "RicLaunchRegressionTestsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicLaunchRegressionTestsFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLaunchRegressionTestsFeature::onActionTriggered(bool isChecked)
{
RiaRegressionTest regTestConfig;
caf::PdmSettings::readFieldsFromApplicationStore(&regTestConfig);
QStringList testFilter = regTestConfig.testFilter().split(";", QString::SkipEmptyParts);
// Launch regression test using the current test folder and test filter
RiaApplication::instance()->executeRegressionTests(regTestConfig.regressionTestFolder, &testFilter);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLaunchRegressionTestsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Launch Regression Tests");
}

View File

@@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicLaunchRegressionTestsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
private:
bool isCommandEnabled() override;
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
};