forked from qt-creator/qt-creator
AutoTest: Separate test configurations
Change-Id: I573b703b4f9ec246cf429d2602b6dc0b8174b50f Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "testconfiguration.h"
|
||||
#include "testoutputreader.h"
|
||||
#include "testsettings.h"
|
||||
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cpptools/projectinfo.h>
|
||||
@@ -43,19 +45,8 @@ using namespace ProjectExplorer;
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
TestConfiguration::TestConfiguration(const QString &testClass, const QStringList &testCases,
|
||||
int testCaseCount, QObject *parent)
|
||||
: QObject(parent),
|
||||
m_testClass(testClass),
|
||||
m_testCases(testCases),
|
||||
m_testCaseCount(testCaseCount),
|
||||
m_unnamedOnly(false),
|
||||
m_project(0),
|
||||
m_guessedConfiguration(false),
|
||||
m_type(TestTypeQt)
|
||||
TestConfiguration::TestConfiguration()
|
||||
{
|
||||
if (testCases.size() != 0)
|
||||
m_testCaseCount = testCases.size();
|
||||
}
|
||||
|
||||
TestConfiguration::~TestConfiguration()
|
||||
@@ -252,19 +243,73 @@ void TestConfiguration::setProject(Project *project)
|
||||
m_project = project;
|
||||
}
|
||||
|
||||
void TestConfiguration::setUnnamedOnly(bool unnamedOnly)
|
||||
{
|
||||
m_unnamedOnly = unnamedOnly;
|
||||
}
|
||||
|
||||
void TestConfiguration::setGuessedConfiguration(bool guessed)
|
||||
{
|
||||
m_guessedConfiguration = guessed;
|
||||
}
|
||||
|
||||
void TestConfiguration::setTestType(TestType type)
|
||||
TestOutputReader *QtTestConfiguration::outputReader(const QFutureInterface<TestResultPtr> &fi,
|
||||
QProcess *app) const
|
||||
{
|
||||
m_type = type;
|
||||
return new QtTestOutputReader(fi, app, buildDirectory());
|
||||
}
|
||||
|
||||
QStringList QtTestConfiguration::argumentsForTestRunner(const TestSettings &settings) const
|
||||
{
|
||||
QStringList arguments("-xml");
|
||||
|
||||
const QString &metricsOption = TestSettings::metricsTypeToOption(settings.metrics);
|
||||
if (!metricsOption.isEmpty())
|
||||
arguments << metricsOption;
|
||||
if (testCases().count())
|
||||
arguments << testCases();
|
||||
return arguments;
|
||||
}
|
||||
|
||||
TestOutputReader *QuickTestConfiguration::outputReader(const QFutureInterface<TestResultPtr> &fi,
|
||||
QProcess *app) const
|
||||
{
|
||||
return new QtTestOutputReader(fi, app, buildDirectory());
|
||||
}
|
||||
|
||||
QStringList QuickTestConfiguration::argumentsForTestRunner(const TestSettings &settings) const
|
||||
{
|
||||
QStringList arguments("-xml");
|
||||
|
||||
const QString &metricsOption = TestSettings::metricsTypeToOption(settings.metrics);
|
||||
if (!metricsOption.isEmpty())
|
||||
arguments << metricsOption;
|
||||
if (testCases().count())
|
||||
arguments << testCases();
|
||||
return arguments;
|
||||
}
|
||||
|
||||
void QuickTestConfiguration::setUnnamedOnly(bool unnamedOnly)
|
||||
{
|
||||
m_unnamedOnly = unnamedOnly;
|
||||
}
|
||||
|
||||
TestOutputReader *GoogleTestConfiguration::outputReader(const QFutureInterface<TestResultPtr> &fi,
|
||||
QProcess *app) const
|
||||
{
|
||||
return new GTestOutputReader(fi, app, buildDirectory());
|
||||
}
|
||||
|
||||
QStringList GoogleTestConfiguration::argumentsForTestRunner(const TestSettings &settings) const
|
||||
{
|
||||
QStringList arguments;
|
||||
const QStringList &testSets = testCases();
|
||||
if (testSets.size())
|
||||
arguments << QLatin1String("--gtest_filter=") + testSets.join(QLatin1Char(':'));
|
||||
if (settings.gtestRunDisabled)
|
||||
arguments << QLatin1String("--gtest_also_run_disabled_tests");
|
||||
if (settings.gtestRepeat)
|
||||
arguments << QString::fromLatin1("--gtest_repeat=%1").arg(settings.gtestIterations);
|
||||
if (settings.gtestShuffle) {
|
||||
arguments << QLatin1String("--gtest_shuffle")
|
||||
<< QString::fromLatin1("--gtest_random_seed=%1").arg(settings.gtestSeed);
|
||||
}
|
||||
return arguments;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user