forked from qt-creator/qt-creator
Autotest: Keep track of generating framework in TestTreeItem
... and TestConfiguration. This allows dropping code that reconstruct framework ids and framework lookup by id. Change-Id: I0bb1e6e135376e21f96b9fab7971aa097787e483 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -29,24 +29,16 @@
|
|||||||
#include "boosttestsettings.h"
|
#include "boosttestsettings.h"
|
||||||
|
|
||||||
#include "../autotestplugin.h"
|
#include "../autotestplugin.h"
|
||||||
#include "../testframeworkmanager.h"
|
#include "../itestframework.h"
|
||||||
#include "../testsettings.h"
|
#include "../testsettings.h"
|
||||||
|
|
||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
static BoostTestSettings *getBoostSettings()
|
|
||||||
{
|
|
||||||
const Core::Id id = Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(
|
|
||||||
BoostTest::Constants::FRAMEWORK_NAME);
|
|
||||||
TestFrameworkManager *manager = TestFrameworkManager::instance();
|
|
||||||
return dynamic_cast<BoostTestSettings *>(manager->settingsForTestFramework(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
TestOutputReader *BoostTestConfiguration::outputReader(const QFutureInterface<TestResultPtr> &fi,
|
TestOutputReader *BoostTestConfiguration::outputReader(const QFutureInterface<TestResultPtr> &fi,
|
||||||
QProcess *app) const
|
QProcess *app) const
|
||||||
{
|
{
|
||||||
auto settings = getBoostSettings();
|
auto settings = dynamic_cast<BoostTestSettings *>(framework()->frameworkSettings());
|
||||||
return new BoostTestOutputReader(fi, app, buildDirectory(), projectFile(),
|
return new BoostTestOutputReader(fi, app, buildDirectory(), projectFile(),
|
||||||
settings->logLevel, settings->reportLevel);
|
settings->logLevel, settings->reportLevel);
|
||||||
}
|
}
|
||||||
@@ -113,7 +105,7 @@ static QStringList filterInterfering(const QStringList &provided, QStringList *o
|
|||||||
|
|
||||||
QStringList BoostTestConfiguration::argumentsForTestRunner(QStringList *omitted) const
|
QStringList BoostTestConfiguration::argumentsForTestRunner(QStringList *omitted) const
|
||||||
{
|
{
|
||||||
auto boostSettings = getBoostSettings();
|
auto boostSettings = dynamic_cast<BoostTestSettings *>(framework()->frameworkSettings());
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments << "-l" << BoostTestSettings::logLevelToOption(boostSettings->logLevel);
|
arguments << "-l" << BoostTestSettings::logLevelToOption(boostSettings->logLevel);
|
||||||
arguments << "-r" << BoostTestSettings::reportLevelToOption(boostSettings->reportLevel);
|
arguments << "-r" << BoostTestSettings::reportLevelToOption(boostSettings->reportLevel);
|
||||||
|
@@ -33,7 +33,8 @@ namespace Internal {
|
|||||||
class BoostTestConfiguration : public DebuggableTestConfiguration
|
class BoostTestConfiguration : public DebuggableTestConfiguration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BoostTestConfiguration() {}
|
explicit BoostTestConfiguration(ITestFramework *framework)
|
||||||
|
: DebuggableTestConfiguration(framework) {}
|
||||||
TestOutputReader *outputReader(const QFutureInterface<TestResultPtr> &fi,
|
TestOutputReader *outputReader(const QFutureInterface<TestResultPtr> &fi,
|
||||||
QProcess *app) const override;
|
QProcess *app) const override;
|
||||||
QStringList argumentsForTestRunner(QStringList *omitted = nullptr) const override;
|
QStringList argumentsForTestRunner(QStringList *omitted = nullptr) const override;
|
||||||
|
@@ -37,9 +37,10 @@ ITestParser *BoostTestFramework::createTestParser()
|
|||||||
return new BoostTestParser(this);
|
return new BoostTestParser(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestTreeItem *BoostTestFramework::createRootNode() const
|
TestTreeItem *BoostTestFramework::createRootNode()
|
||||||
{
|
{
|
||||||
return new BoostTestTreeItem(
|
return new BoostTestTreeItem(
|
||||||
|
this,
|
||||||
QCoreApplication::translate("BoostTestFramework",
|
QCoreApplication::translate("BoostTestFramework",
|
||||||
BoostTest::Constants::FRAMEWORK_SETTINGS_CATEGORY),
|
BoostTest::Constants::FRAMEWORK_SETTINGS_CATEGORY),
|
||||||
QString(), TestTreeItem::Root);
|
QString(), TestTreeItem::Root);
|
||||||
|
@@ -43,7 +43,7 @@ private:
|
|||||||
unsigned priority() const override;
|
unsigned priority() const override;
|
||||||
IFrameworkSettings *frameworkSettings() override { return &m_settings; }
|
IFrameworkSettings *frameworkSettings() override { return &m_settings; }
|
||||||
ITestParser *createTestParser() override;
|
ITestParser *createTestParser() override;
|
||||||
TestTreeItem *createRootNode() const override;
|
TestTreeItem *createRootNode() override;
|
||||||
|
|
||||||
BoostTestSettings m_settings;
|
BoostTestSettings m_settings;
|
||||||
BoostTestSettingsPage m_settingsPage{&m_settings, settingsId()};
|
BoostTestSettingsPage m_settingsPage{&m_settings, settingsId()};
|
||||||
|
@@ -56,7 +56,7 @@ TestTreeItem *BoostTestParseResult::createTestTreeItem() const
|
|||||||
if (itemType == TestTreeItem::Root)
|
if (itemType == TestTreeItem::Root)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
BoostTestTreeItem *item = new BoostTestTreeItem(displayName, fileName, itemType);
|
BoostTestTreeItem *item = new BoostTestTreeItem(framework, displayName, fileName, itemType);
|
||||||
item->setProFile(proFile);
|
item->setProFile(proFile);
|
||||||
item->setLine(line);
|
item->setLine(line);
|
||||||
item->setColumn(column);
|
item->setColumn(column);
|
||||||
|
@@ -40,7 +40,7 @@ namespace Internal {
|
|||||||
|
|
||||||
TestTreeItem *BoostTestTreeItem::copyWithoutChildren()
|
TestTreeItem *BoostTestTreeItem::copyWithoutChildren()
|
||||||
{
|
{
|
||||||
BoostTestTreeItem *copied = new BoostTestTreeItem;
|
BoostTestTreeItem *copied = new BoostTestTreeItem(framework());
|
||||||
copied->copyBasicDataFrom(this);
|
copied->copyBasicDataFrom(this);
|
||||||
copied->m_state = m_state;
|
copied->m_state = m_state;
|
||||||
copied->m_fullName = m_fullName;
|
copied->m_fullName = m_fullName;
|
||||||
@@ -146,7 +146,7 @@ TestTreeItem *BoostTestTreeItem::createParentGroupNode() const
|
|||||||
{
|
{
|
||||||
const QFileInfo fileInfo(filePath());
|
const QFileInfo fileInfo(filePath());
|
||||||
const QFileInfo base(fileInfo.absolutePath());
|
const QFileInfo base(fileInfo.absolutePath());
|
||||||
return new BoostTestTreeItem(base.baseName(), fileInfo.absolutePath(), TestTreeItem::GroupNode);
|
return new BoostTestTreeItem(framework(), base.baseName(), fileInfo.absolutePath(), TestTreeItem::GroupNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BoostTestTreeItem::prependWithParentsSuitePaths(const QString &testName) const
|
QString BoostTestTreeItem::prependWithParentsSuitePaths(const QString &testName) const
|
||||||
@@ -204,7 +204,7 @@ QList<TestConfiguration *> BoostTestTreeItem::getAllTestConfigurations() const
|
|||||||
|
|
||||||
for (auto it = testsPerProjectfile.begin(), end = testsPerProjectfile.end(); it != end; ++it) {
|
for (auto it = testsPerProjectfile.begin(), end = testsPerProjectfile.end(); it != end; ++it) {
|
||||||
for (const QString &target : qAsConst(it.value().internalTargets)) {
|
for (const QString &target : qAsConst(it.value().internalTargets)) {
|
||||||
BoostTestConfiguration *config = new BoostTestConfiguration;
|
BoostTestConfiguration *config = new BoostTestConfiguration(framework());
|
||||||
config->setProject(project);
|
config->setProject(project);
|
||||||
config->setProjectFile(it.key());
|
config->setProjectFile(it.key());
|
||||||
config->setTestCaseCount(it.value().testCases);
|
config->setTestCaseCount(it.value().testCases);
|
||||||
@@ -250,7 +250,7 @@ QList<TestConfiguration *> BoostTestTreeItem::getSelectedTestConfigurations() co
|
|||||||
auto end = testCasesForProjectFile.cend();
|
auto end = testCasesForProjectFile.cend();
|
||||||
for (auto it = testCasesForProjectFile.cbegin(); it != end; ++it) {
|
for (auto it = testCasesForProjectFile.cbegin(); it != end; ++it) {
|
||||||
for (const QString &target : it.value().internalTargets) {
|
for (const QString &target : it.value().internalTargets) {
|
||||||
BoostTestConfiguration *config = new BoostTestConfiguration;
|
BoostTestConfiguration *config = new BoostTestConfiguration(framework());
|
||||||
config->setProject(project);
|
config->setProject(project);
|
||||||
config->setProjectFile(it.key());
|
config->setProjectFile(it.key());
|
||||||
config->setTestCases(it.value().testCases);
|
config->setTestCases(it.value().testCases);
|
||||||
@@ -294,7 +294,7 @@ TestConfiguration *BoostTestTreeItem::testConfiguration() const
|
|||||||
testCases.append(prependWithParentsSuitePaths(handleSpecialFunctionNames(tcName)));
|
testCases.append(prependWithParentsSuitePaths(handleSpecialFunctionNames(tcName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
BoostTestConfiguration *config = new BoostTestConfiguration;
|
BoostTestConfiguration *config = new BoostTestConfiguration(framework());
|
||||||
config->setProjectFile(proFile());
|
config->setProjectFile(proFile());
|
||||||
config->setProject(project);
|
config->setProject(project);
|
||||||
config->setTestCases(testCases);
|
config->setTestCases(testCases);
|
||||||
|
@@ -48,8 +48,12 @@ public:
|
|||||||
Q_FLAGS(TestState)
|
Q_FLAGS(TestState)
|
||||||
Q_DECLARE_FLAGS(TestStates, TestState)
|
Q_DECLARE_FLAGS(TestStates, TestState)
|
||||||
|
|
||||||
explicit BoostTestTreeItem(const QString &name = QString(), const QString &filePath = QString(),
|
explicit BoostTestTreeItem(ITestFramework *framework,
|
||||||
Type type = Root) : TestTreeItem(name, filePath, type) {}
|
const QString &name = QString(),
|
||||||
|
const QString &filePath = QString(),
|
||||||
|
Type type = Root)
|
||||||
|
: TestTreeItem(framework, name, filePath, type)
|
||||||
|
{}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TestTreeItem *copyWithoutChildren() override;
|
TestTreeItem *copyWithoutChildren() override;
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "gtestoutputreader.h"
|
#include "gtestoutputreader.h"
|
||||||
#include "gtestsettings.h"
|
#include "gtestsettings.h"
|
||||||
#include "../autotestplugin.h"
|
#include "../autotestplugin.h"
|
||||||
#include "../testframeworkmanager.h"
|
#include "../itestframework.h"
|
||||||
#include "../testsettings.h"
|
#include "../testsettings.h"
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
@@ -73,9 +73,6 @@ QStringList filterInterfering(const QStringList &provided, QStringList *omitted)
|
|||||||
|
|
||||||
QStringList GTestConfiguration::argumentsForTestRunner(QStringList *omitted) const
|
QStringList GTestConfiguration::argumentsForTestRunner(QStringList *omitted) const
|
||||||
{
|
{
|
||||||
static const Core::Id id
|
|
||||||
= Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(GTest::Constants::FRAMEWORK_NAME);
|
|
||||||
|
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
if (AutotestPlugin::settings()->processArgs) {
|
if (AutotestPlugin::settings()->processArgs) {
|
||||||
arguments << filterInterfering(runnable().commandLineArguments.split(
|
arguments << filterInterfering(runnable().commandLineArguments.split(
|
||||||
@@ -86,8 +83,7 @@ QStringList GTestConfiguration::argumentsForTestRunner(QStringList *omitted) con
|
|||||||
if (!testSets.isEmpty())
|
if (!testSets.isEmpty())
|
||||||
arguments << "--gtest_filter=" + testSets.join(':');
|
arguments << "--gtest_filter=" + testSets.join(':');
|
||||||
|
|
||||||
TestFrameworkManager *manager = TestFrameworkManager::instance();
|
auto gSettings = dynamic_cast<GTestSettings *>(framework()->frameworkSettings());
|
||||||
auto gSettings = dynamic_cast<GTestSettings *>(manager->settingsForTestFramework(id));
|
|
||||||
if (!gSettings)
|
if (!gSettings)
|
||||||
return arguments;
|
return arguments;
|
||||||
|
|
||||||
|
@@ -33,7 +33,9 @@ namespace Internal {
|
|||||||
class GTestConfiguration : public DebuggableTestConfiguration
|
class GTestConfiguration : public DebuggableTestConfiguration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit GTestConfiguration() {}
|
explicit GTestConfiguration(ITestFramework *framework)
|
||||||
|
: DebuggableTestConfiguration(framework) {}
|
||||||
|
|
||||||
TestOutputReader *outputReader(const QFutureInterface<TestResultPtr> &fi,
|
TestOutputReader *outputReader(const QFutureInterface<TestResultPtr> &fi,
|
||||||
QProcess *app) const override;
|
QProcess *app) const override;
|
||||||
QStringList argumentsForTestRunner(QStringList *omitted = nullptr) const override;
|
QStringList argumentsForTestRunner(QStringList *omitted = nullptr) const override;
|
||||||
|
@@ -44,9 +44,10 @@ ITestParser *GTestFramework::createTestParser()
|
|||||||
return new GTestParser(this);
|
return new GTestParser(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestTreeItem *GTestFramework::createRootNode() const
|
TestTreeItem *GTestFramework::createRootNode()
|
||||||
{
|
{
|
||||||
return new GTestTreeItem(
|
return new GTestTreeItem(
|
||||||
|
this,
|
||||||
QCoreApplication::translate("GTestFramework",
|
QCoreApplication::translate("GTestFramework",
|
||||||
GTest::Constants::FRAMEWORK_SETTINGS_CATEGORY),
|
GTest::Constants::FRAMEWORK_SETTINGS_CATEGORY),
|
||||||
QString(), TestTreeItem::Root);
|
QString(), TestTreeItem::Root);
|
||||||
|
@@ -47,7 +47,7 @@ private:
|
|||||||
QString groupingToolTip() const override;
|
QString groupingToolTip() const override;
|
||||||
IFrameworkSettings *frameworkSettings() override { return &m_settings; }
|
IFrameworkSettings *frameworkSettings() override { return &m_settings; }
|
||||||
ITestParser *createTestParser() override;
|
ITestParser *createTestParser() override;
|
||||||
TestTreeItem *createRootNode() const override;
|
TestTreeItem *createRootNode() override;
|
||||||
|
|
||||||
GTestSettings m_settings;
|
GTestSettings m_settings;
|
||||||
GTestSettingsPage m_settingsPage{&m_settings, settingsId()};
|
GTestSettingsPage m_settingsPage{&m_settings, settingsId()};
|
||||||
|
@@ -32,8 +32,6 @@
|
|||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class GTestResult;
|
|
||||||
|
|
||||||
class GTestOutputReader : public TestOutputReader
|
class GTestOutputReader : public TestOutputReader
|
||||||
{
|
{
|
||||||
Q_DECLARE_TR_FUNCTIONS(Autotest::Internal::GTestOutputReader)
|
Q_DECLARE_TR_FUNCTIONS(Autotest::Internal::GTestOutputReader)
|
||||||
|
@@ -38,7 +38,7 @@ TestTreeItem *GTestParseResult::createTestTreeItem() const
|
|||||||
{
|
{
|
||||||
if (itemType != TestTreeItem::TestSuite && itemType != TestTreeItem::TestCase)
|
if (itemType != TestTreeItem::TestSuite && itemType != TestTreeItem::TestCase)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
GTestTreeItem *item = new GTestTreeItem(name, fileName, itemType);
|
GTestTreeItem *item = new GTestTreeItem(framework, name, fileName, itemType);
|
||||||
item->setProFile(proFile);
|
item->setProFile(proFile);
|
||||||
item->setLine(line);
|
item->setLine(line);
|
||||||
item->setColumn(column);
|
item->setColumn(column);
|
||||||
|
@@ -65,7 +65,7 @@ static QString gtestFilter(GTestTreeItem::TestStates states)
|
|||||||
|
|
||||||
TestTreeItem *GTestTreeItem::copyWithoutChildren()
|
TestTreeItem *GTestTreeItem::copyWithoutChildren()
|
||||||
{
|
{
|
||||||
GTestTreeItem *copied = new GTestTreeItem;
|
GTestTreeItem *copied = new GTestTreeItem(framework());
|
||||||
copied->copyBasicDataFrom(this);
|
copied->copyBasicDataFrom(this);
|
||||||
copied->m_state = m_state;
|
copied->m_state = m_state;
|
||||||
return copied;
|
return copied;
|
||||||
@@ -170,7 +170,7 @@ TestConfiguration *GTestTreeItem::testConfiguration() const
|
|||||||
case TestSuite: {
|
case TestSuite: {
|
||||||
const QString &testSpecifier = gtestFilter(state()).arg(name()).arg('*');
|
const QString &testSpecifier = gtestFilter(state()).arg(name()).arg('*');
|
||||||
if (int count = childCount()) {
|
if (int count = childCount()) {
|
||||||
config = new GTestConfiguration;
|
config = new GTestConfiguration(framework());
|
||||||
config->setTestCases(QStringList(testSpecifier));
|
config->setTestCases(QStringList(testSpecifier));
|
||||||
config->setTestCaseCount(count);
|
config->setTestCaseCount(count);
|
||||||
config->setProjectFile(proFile());
|
config->setProjectFile(proFile());
|
||||||
@@ -183,7 +183,7 @@ TestConfiguration *GTestTreeItem::testConfiguration() const
|
|||||||
if (!parent)
|
if (!parent)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
const QString &testSpecifier = gtestFilter(parent->state()).arg(parent->name()).arg(name());
|
const QString &testSpecifier = gtestFilter(parent->state()).arg(parent->name()).arg(name());
|
||||||
config = new GTestConfiguration;
|
config = new GTestConfiguration(framework());
|
||||||
config->setTestCases(QStringList(testSpecifier));
|
config->setTestCases(QStringList(testSpecifier));
|
||||||
config->setProjectFile(proFile());
|
config->setProjectFile(proFile());
|
||||||
config->setProject(project);
|
config->setProject(project);
|
||||||
@@ -261,7 +261,7 @@ QList<TestConfiguration *> GTestTreeItem::getTestConfigurations(bool ignoreCheck
|
|||||||
|
|
||||||
for (auto it = testCasesForProFile.begin(), end = testCasesForProFile.end(); it != end; ++it) {
|
for (auto it = testCasesForProFile.begin(), end = testCasesForProFile.end(); it != end; ++it) {
|
||||||
for (const QString &target : qAsConst(it.value().internalTargets)) {
|
for (const QString &target : qAsConst(it.value().internalTargets)) {
|
||||||
GTestConfiguration *tc = new GTestConfiguration;
|
GTestConfiguration *tc = new GTestConfiguration(framework());
|
||||||
if (!ignoreCheckState)
|
if (!ignoreCheckState)
|
||||||
tc->setTestCases(it.value().filters);
|
tc->setTestCases(it.value().filters);
|
||||||
tc->setTestCaseCount(tc->testCaseCount() + it.value().testSetCount);
|
tc->setTestCaseCount(tc->testCaseCount() + it.value().testSetCount);
|
||||||
@@ -307,7 +307,7 @@ QList<TestConfiguration *> GTestTreeItem::getTestConfigurationsForFile(const Uti
|
|||||||
});
|
});
|
||||||
for (auto it = testCases.begin(), end = testCases.end(); it != end; ++it) {
|
for (auto it = testCases.begin(), end = testCases.end(); it != end; ++it) {
|
||||||
for (const QString &target : qAsConst(it.value().internalTargets)) {
|
for (const QString &target : qAsConst(it.value().internalTargets)) {
|
||||||
GTestConfiguration *tc = new GTestConfiguration;
|
GTestConfiguration *tc = new GTestConfiguration(framework());
|
||||||
tc->setTestCases(it.value().filters);
|
tc->setTestCases(it.value().filters);
|
||||||
tc->setProjectFile(it.key());
|
tc->setProjectFile(it.key());
|
||||||
tc->setProject(project);
|
tc->setProject(project);
|
||||||
@@ -420,7 +420,7 @@ TestTreeItem *GTestTreeItem::createParentGroupNode() const
|
|||||||
if (GTestFramework::groupMode() == GTest::Constants::Directory) {
|
if (GTestFramework::groupMode() == GTest::Constants::Directory) {
|
||||||
const QFileInfo fileInfo(filePath());
|
const QFileInfo fileInfo(filePath());
|
||||||
const QFileInfo base(fileInfo.absolutePath());
|
const QFileInfo base(fileInfo.absolutePath());
|
||||||
return new GTestTreeItem(base.baseName(), fileInfo.absolutePath(), TestTreeItem::GroupNode);
|
return new GTestTreeItem(framework(), base.baseName(), fileInfo.absolutePath(), TestTreeItem::GroupNode);
|
||||||
} else { // GTestFilter
|
} else { // GTestFilter
|
||||||
QTC_ASSERT(childCount(), return nullptr); // paranoia
|
QTC_ASSERT(childCount(), return nullptr); // paranoia
|
||||||
const TestTreeItem *firstChild = childAt(0);
|
const TestTreeItem *firstChild = childAt(0);
|
||||||
@@ -428,7 +428,7 @@ TestTreeItem *GTestTreeItem::createParentGroupNode() const
|
|||||||
const QString fullTestName = name() + '.' + firstChild->name();
|
const QString fullTestName = name() + '.' + firstChild->name();
|
||||||
const QString groupNodeName =
|
const QString groupNodeName =
|
||||||
matchesFilter(activeFilter, fullTestName) ? matchingString() : notMatchingString();
|
matchesFilter(activeFilter, fullTestName) ? matchingString() : notMatchingString();
|
||||||
auto groupNode = new GTestTreeItem(groupNodeName, activeFilter, TestTreeItem::GroupNode);
|
auto groupNode = new GTestTreeItem(framework(), groupNodeName, activeFilter, TestTreeItem::GroupNode);
|
||||||
if (groupNodeName == notMatchingString())
|
if (groupNodeName == notMatchingString())
|
||||||
groupNode->setData(0, Qt::Unchecked, Qt::CheckStateRole);
|
groupNode->setData(0, Qt::Unchecked, Qt::CheckStateRole);
|
||||||
return groupNode;
|
return groupNode;
|
||||||
|
@@ -46,8 +46,12 @@ public:
|
|||||||
Q_FLAGS(TestState)
|
Q_FLAGS(TestState)
|
||||||
Q_DECLARE_FLAGS(TestStates, TestState)
|
Q_DECLARE_FLAGS(TestStates, TestState)
|
||||||
|
|
||||||
explicit GTestTreeItem(const QString &name = QString(), const QString &filePath = QString(),
|
explicit GTestTreeItem(ITestFramework *framework,
|
||||||
Type type = Root) : TestTreeItem(name, filePath, type), m_state(Enabled) {}
|
const QString &name = QString(),
|
||||||
|
const QString &filePath = QString(),
|
||||||
|
Type type = Root)
|
||||||
|
: TestTreeItem(framework, name, filePath, type), m_state(Enabled)
|
||||||
|
{}
|
||||||
|
|
||||||
TestTreeItem *copyWithoutChildren() override;
|
TestTreeItem *copyWithoutChildren() override;
|
||||||
QVariant data(int column, int role) const override;
|
QVariant data(int column, int role) const override;
|
||||||
|
@@ -83,7 +83,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ITestParser *createTestParser() = 0;
|
virtual ITestParser *createTestParser() = 0;
|
||||||
virtual TestTreeItem *createRootNode() const = 0;
|
virtual TestTreeItem *createRootNode() = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TestTreeItem *m_rootNode = nullptr;
|
TestTreeItem *m_rootNode = nullptr;
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#include "qttestsettings.h"
|
#include "qttestsettings.h"
|
||||||
#include "qttest_utils.h"
|
#include "qttest_utils.h"
|
||||||
#include "../autotestplugin.h"
|
#include "../autotestplugin.h"
|
||||||
#include "../testframeworkmanager.h"
|
#include "../itestframework.h"
|
||||||
#include "../testsettings.h"
|
#include "../testsettings.h"
|
||||||
|
|
||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
@@ -38,10 +38,7 @@ namespace Internal {
|
|||||||
TestOutputReader *QtTestConfiguration::outputReader(const QFutureInterface<TestResultPtr> &fi,
|
TestOutputReader *QtTestConfiguration::outputReader(const QFutureInterface<TestResultPtr> &fi,
|
||||||
QProcess *app) const
|
QProcess *app) const
|
||||||
{
|
{
|
||||||
static const Core::Id id
|
auto qtSettings = dynamic_cast<QtTestSettings *>(framework()->frameworkSettings());
|
||||||
= Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(QtTest::Constants::FRAMEWORK_NAME);
|
|
||||||
TestFrameworkManager *manager = TestFrameworkManager::instance();
|
|
||||||
auto qtSettings = dynamic_cast<QtTestSettings *>(manager->settingsForTestFramework(id));
|
|
||||||
const QtTestOutputReader::OutputMode mode = qtSettings && qtSettings->useXMLOutput
|
const QtTestOutputReader::OutputMode mode = qtSettings && qtSettings->useXMLOutput
|
||||||
? QtTestOutputReader::XML
|
? QtTestOutputReader::XML
|
||||||
: QtTestOutputReader::PlainText;
|
: QtTestOutputReader::PlainText;
|
||||||
@@ -50,17 +47,13 @@ TestOutputReader *QtTestConfiguration::outputReader(const QFutureInterface<TestR
|
|||||||
|
|
||||||
QStringList QtTestConfiguration::argumentsForTestRunner(QStringList *omitted) const
|
QStringList QtTestConfiguration::argumentsForTestRunner(QStringList *omitted) const
|
||||||
{
|
{
|
||||||
static const Core::Id id
|
|
||||||
= Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(QtTest::Constants::FRAMEWORK_NAME);
|
|
||||||
|
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
if (AutotestPlugin::settings()->processArgs) {
|
if (AutotestPlugin::settings()->processArgs) {
|
||||||
arguments.append(QTestUtils::filterInterfering(
|
arguments.append(QTestUtils::filterInterfering(
|
||||||
runnable().commandLineArguments.split(' ', QString::SkipEmptyParts),
|
runnable().commandLineArguments.split(' ', QString::SkipEmptyParts),
|
||||||
omitted, false));
|
omitted, false));
|
||||||
}
|
}
|
||||||
TestFrameworkManager *manager = TestFrameworkManager::instance();
|
auto qtSettings = dynamic_cast<QtTestSettings *>(framework()->frameworkSettings());
|
||||||
auto qtSettings = dynamic_cast<QtTestSettings *>(manager->settingsForTestFramework(id));
|
|
||||||
if (!qtSettings)
|
if (!qtSettings)
|
||||||
return arguments;
|
return arguments;
|
||||||
if (qtSettings->useXMLOutput)
|
if (qtSettings->useXMLOutput)
|
||||||
|
@@ -33,7 +33,8 @@ namespace Internal {
|
|||||||
class QtTestConfiguration : public DebuggableTestConfiguration
|
class QtTestConfiguration : public DebuggableTestConfiguration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit QtTestConfiguration() {}
|
explicit QtTestConfiguration(ITestFramework *framework)
|
||||||
|
: DebuggableTestConfiguration(framework) {}
|
||||||
TestOutputReader *outputReader(const QFutureInterface<TestResultPtr> &fi,
|
TestOutputReader *outputReader(const QFutureInterface<TestResultPtr> &fi,
|
||||||
QProcess *app) const override;
|
QProcess *app) const override;
|
||||||
QStringList argumentsForTestRunner(QStringList *omitted = nullptr) const override;
|
QStringList argumentsForTestRunner(QStringList *omitted = nullptr) const override;
|
||||||
|
@@ -36,9 +36,10 @@ ITestParser *QtTestFramework::createTestParser()
|
|||||||
return new QtTestParser(this);
|
return new QtTestParser(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestTreeItem *QtTestFramework::createRootNode() const
|
TestTreeItem *QtTestFramework::createRootNode()
|
||||||
{
|
{
|
||||||
return new QtTestTreeItem(
|
return new QtTestTreeItem(
|
||||||
|
this,
|
||||||
QCoreApplication::translate("QtTestFramework",
|
QCoreApplication::translate("QtTestFramework",
|
||||||
QtTest::Constants::FRAMEWORK_SETTINGS_CATEGORY),
|
QtTest::Constants::FRAMEWORK_SETTINGS_CATEGORY),
|
||||||
QString(), TestTreeItem::Root);
|
QString(), TestTreeItem::Root);
|
||||||
|
@@ -42,7 +42,7 @@ private:
|
|||||||
const char *name() const override;
|
const char *name() const override;
|
||||||
unsigned priority() const override;
|
unsigned priority() const override;
|
||||||
ITestParser *createTestParser() override;
|
ITestParser *createTestParser() override;
|
||||||
TestTreeItem *createRootNode() const override;
|
TestTreeItem *createRootNode() override;
|
||||||
IFrameworkSettings *frameworkSettings() override { return &m_settings; }
|
IFrameworkSettings *frameworkSettings() override { return &m_settings; }
|
||||||
|
|
||||||
QtTestSettings m_settings;
|
QtTestSettings m_settings;
|
||||||
|
@@ -41,7 +41,7 @@ TestTreeItem *QtTestParseResult::createTestTreeItem() const
|
|||||||
if (itemType == TestTreeItem::Root)
|
if (itemType == TestTreeItem::Root)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
QtTestTreeItem *item = new QtTestTreeItem(displayName, fileName, itemType);
|
QtTestTreeItem *item = new QtTestTreeItem(framework, displayName, fileName, itemType);
|
||||||
item->setProFile(proFile);
|
item->setProFile(proFile);
|
||||||
item->setLine(line);
|
item->setLine(line);
|
||||||
item->setColumn(column);
|
item->setColumn(column);
|
||||||
|
@@ -34,8 +34,9 @@
|
|||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
QtTestTreeItem::QtTestTreeItem(const QString &name, const QString &filePath, TestTreeItem::Type type)
|
QtTestTreeItem::QtTestTreeItem(ITestFramework *framework, const QString &name,
|
||||||
: TestTreeItem(name, filePath, type)
|
const QString &filePath, TestTreeItem::Type type)
|
||||||
|
: TestTreeItem(framework, name, filePath, type)
|
||||||
{
|
{
|
||||||
if (type == TestDataTag)
|
if (type == TestDataTag)
|
||||||
setData(0, Qt::Checked, Qt::CheckStateRole);
|
setData(0, Qt::Checked, Qt::CheckStateRole);
|
||||||
@@ -43,7 +44,7 @@ QtTestTreeItem::QtTestTreeItem(const QString &name, const QString &filePath, Tes
|
|||||||
|
|
||||||
TestTreeItem *QtTestTreeItem::copyWithoutChildren()
|
TestTreeItem *QtTestTreeItem::copyWithoutChildren()
|
||||||
{
|
{
|
||||||
QtTestTreeItem *copied = new QtTestTreeItem;
|
QtTestTreeItem *copied = new QtTestTreeItem(framework());
|
||||||
copied->copyBasicDataFrom(this);
|
copied->copyBasicDataFrom(this);
|
||||||
copied->m_inherited = m_inherited;
|
copied->m_inherited = m_inherited;
|
||||||
return copied;
|
return copied;
|
||||||
@@ -114,14 +115,14 @@ TestConfiguration *QtTestTreeItem::testConfiguration() const
|
|||||||
QtTestConfiguration *config = nullptr;
|
QtTestConfiguration *config = nullptr;
|
||||||
switch (type()) {
|
switch (type()) {
|
||||||
case TestCase:
|
case TestCase:
|
||||||
config = new QtTestConfiguration;
|
config = new QtTestConfiguration(framework());
|
||||||
config->setTestCaseCount(childCount());
|
config->setTestCaseCount(childCount());
|
||||||
config->setProjectFile(proFile());
|
config->setProjectFile(proFile());
|
||||||
config->setProject(project);
|
config->setProject(project);
|
||||||
break;
|
break;
|
||||||
case TestFunction: {
|
case TestFunction: {
|
||||||
TestTreeItem *parent = parentItem();
|
TestTreeItem *parent = parentItem();
|
||||||
config = new QtTestConfiguration();
|
config = new QtTestConfiguration(framework());
|
||||||
config->setTestCases(QStringList(name()));
|
config->setTestCases(QStringList(name()));
|
||||||
config->setProjectFile(parent->proFile());
|
config->setProjectFile(parent->proFile());
|
||||||
config->setProject(project);
|
config->setProject(project);
|
||||||
@@ -133,7 +134,7 @@ TestConfiguration *QtTestTreeItem::testConfiguration() const
|
|||||||
if (!parent)
|
if (!parent)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
const QString functionWithTag = function->name() + ':' + name();
|
const QString functionWithTag = function->name() + ':' + name();
|
||||||
config = new QtTestConfiguration();
|
config = new QtTestConfiguration(framework());
|
||||||
config->setTestCases(QStringList(functionWithTag));
|
config->setTestCases(QStringList(functionWithTag));
|
||||||
config->setProjectFile(parent->proFile());
|
config->setProjectFile(parent->proFile());
|
||||||
config->setProject(project);
|
config->setProject(project);
|
||||||
@@ -180,7 +181,7 @@ static void fillTestConfigurationsFromCheckState(const TestTreeItem *item,
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
testConfig = new QtTestConfiguration();
|
testConfig = new QtTestConfiguration(item->framework());
|
||||||
testConfig->setTestCases(testCases);
|
testConfig->setTestCases(testCases);
|
||||||
testConfig->setProjectFile(item->proFile());
|
testConfig->setProjectFile(item->proFile());
|
||||||
testConfig->setProject(ProjectExplorer::SessionManager::startupProject());
|
testConfig->setProject(ProjectExplorer::SessionManager::startupProject());
|
||||||
@@ -342,7 +343,7 @@ TestTreeItem *QtTestTreeItem::createParentGroupNode() const
|
|||||||
{
|
{
|
||||||
const QFileInfo fileInfo(filePath());
|
const QFileInfo fileInfo(filePath());
|
||||||
const QFileInfo base(fileInfo.absolutePath());
|
const QFileInfo base(fileInfo.absolutePath());
|
||||||
return new QtTestTreeItem(base.baseName(), fileInfo.absolutePath(), TestTreeItem::GroupNode);
|
return new QtTestTreeItem(framework(), base.baseName(), fileInfo.absolutePath(), TestTreeItem::GroupNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QtTestTreeItem::isGroupable() const
|
bool QtTestTreeItem::isGroupable() const
|
||||||
|
@@ -33,7 +33,7 @@ namespace Internal {
|
|||||||
class QtTestTreeItem : public TestTreeItem
|
class QtTestTreeItem : public TestTreeItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit QtTestTreeItem(const QString &name = QString(), const QString &filePath = QString(),
|
explicit QtTestTreeItem(ITestFramework *framework, const QString &name = QString(), const QString &filePath = QString(),
|
||||||
Type type = Root);
|
Type type = Root);
|
||||||
|
|
||||||
TestTreeItem *copyWithoutChildren() override;
|
TestTreeItem *copyWithoutChildren() override;
|
||||||
|
@@ -29,13 +29,14 @@
|
|||||||
#include "../qtest/qttestsettings.h"
|
#include "../qtest/qttestsettings.h"
|
||||||
#include "../qtest/qttest_utils.h"
|
#include "../qtest/qttest_utils.h"
|
||||||
#include "../autotestplugin.h"
|
#include "../autotestplugin.h"
|
||||||
#include "../testframeworkmanager.h"
|
#include "../itestframework.h"
|
||||||
#include "../testsettings.h"
|
#include "../testsettings.h"
|
||||||
|
|
||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
QuickTestConfiguration::QuickTestConfiguration()
|
QuickTestConfiguration::QuickTestConfiguration(ITestFramework *framework)
|
||||||
|
: DebuggableTestConfiguration(framework)
|
||||||
{
|
{
|
||||||
setMixedDebugging(true);
|
setMixedDebugging(true);
|
||||||
}
|
}
|
||||||
@@ -43,10 +44,7 @@ QuickTestConfiguration::QuickTestConfiguration()
|
|||||||
TestOutputReader *QuickTestConfiguration::outputReader(const QFutureInterface<TestResultPtr> &fi,
|
TestOutputReader *QuickTestConfiguration::outputReader(const QFutureInterface<TestResultPtr> &fi,
|
||||||
QProcess *app) const
|
QProcess *app) const
|
||||||
{
|
{
|
||||||
static const Core::Id id
|
auto qtSettings = dynamic_cast<QtTestSettings *>(framework()->frameworkSettings());
|
||||||
= Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(QtTest::Constants::FRAMEWORK_NAME);
|
|
||||||
TestFrameworkManager *manager = TestFrameworkManager::instance();
|
|
||||||
auto qtSettings = dynamic_cast<QtTestSettings *>(manager->settingsForTestFramework(id));
|
|
||||||
const QtTestOutputReader::OutputMode mode = qtSettings && qtSettings->useXMLOutput
|
const QtTestOutputReader::OutputMode mode = qtSettings && qtSettings->useXMLOutput
|
||||||
? QtTestOutputReader::XML
|
? QtTestOutputReader::XML
|
||||||
: QtTestOutputReader::PlainText;
|
: QtTestOutputReader::PlainText;
|
||||||
@@ -56,9 +54,6 @@ TestOutputReader *QuickTestConfiguration::outputReader(const QFutureInterface<Te
|
|||||||
|
|
||||||
QStringList QuickTestConfiguration::argumentsForTestRunner(QStringList *omitted) const
|
QStringList QuickTestConfiguration::argumentsForTestRunner(QStringList *omitted) const
|
||||||
{
|
{
|
||||||
static const Core::Id id
|
|
||||||
= Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(QtTest::Constants::FRAMEWORK_NAME);
|
|
||||||
|
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
if (AutotestPlugin::settings()->processArgs) {
|
if (AutotestPlugin::settings()->processArgs) {
|
||||||
arguments.append(QTestUtils::filterInterfering
|
arguments.append(QTestUtils::filterInterfering
|
||||||
@@ -66,8 +61,7 @@ QStringList QuickTestConfiguration::argumentsForTestRunner(QStringList *omitted)
|
|||||||
omitted, true));
|
omitted, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
TestFrameworkManager *manager = TestFrameworkManager::instance();
|
auto qtSettings = dynamic_cast<QtTestSettings *>(framework()->frameworkSettings());
|
||||||
auto qtSettings = dynamic_cast<QtTestSettings *>(manager->settingsForTestFramework(id));
|
|
||||||
if (!qtSettings)
|
if (!qtSettings)
|
||||||
return arguments;
|
return arguments;
|
||||||
if (qtSettings->useXMLOutput)
|
if (qtSettings->useXMLOutput)
|
||||||
|
@@ -33,7 +33,7 @@ namespace Internal {
|
|||||||
class QuickTestConfiguration : public DebuggableTestConfiguration
|
class QuickTestConfiguration : public DebuggableTestConfiguration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QuickTestConfiguration();
|
explicit QuickTestConfiguration(ITestFramework *framework);
|
||||||
TestOutputReader *outputReader(const QFutureInterface<TestResultPtr> &fi,
|
TestOutputReader *outputReader(const QFutureInterface<TestResultPtr> &fi,
|
||||||
QProcess *app) const override;
|
QProcess *app) const override;
|
||||||
QStringList argumentsForTestRunner(QStringList *omitted = nullptr) const override;
|
QStringList argumentsForTestRunner(QStringList *omitted = nullptr) const override;
|
||||||
|
@@ -35,9 +35,9 @@ ITestParser *QuickTestFramework::createTestParser()
|
|||||||
return new QuickTestParser(this);
|
return new QuickTestParser(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestTreeItem *QuickTestFramework::createRootNode() const
|
TestTreeItem *QuickTestFramework::createRootNode()
|
||||||
{
|
{
|
||||||
return new QuickTestTreeItem(QCoreApplication::translate("QuickTestFramework", "Quick Test"),
|
return new QuickTestTreeItem(this, QCoreApplication::translate("QuickTestFramework", "Quick Test"),
|
||||||
QString(), TestTreeItem::Root);
|
QString(), TestTreeItem::Root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -47,7 +47,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
ITestParser *createTestParser() override;
|
ITestParser *createTestParser() override;
|
||||||
TestTreeItem *createRootNode() const override;
|
TestTreeItem *createRootNode() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -49,7 +49,7 @@ TestTreeItem *QuickTestParseResult::createTestTreeItem() const
|
|||||||
if (itemType == TestTreeItem::Root || itemType == TestTreeItem::TestDataTag)
|
if (itemType == TestTreeItem::Root || itemType == TestTreeItem::TestDataTag)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
QuickTestTreeItem *item = new QuickTestTreeItem(name, fileName, itemType);
|
QuickTestTreeItem *item = new QuickTestTreeItem(framework, name, fileName, itemType);
|
||||||
item->setProFile(proFile);
|
item->setProFile(proFile);
|
||||||
item->setLine(line);
|
item->setLine(line);
|
||||||
item->setColumn(column);
|
item->setColumn(column);
|
||||||
|
@@ -38,7 +38,7 @@ namespace Internal {
|
|||||||
|
|
||||||
TestTreeItem *QuickTestTreeItem::copyWithoutChildren()
|
TestTreeItem *QuickTestTreeItem::copyWithoutChildren()
|
||||||
{
|
{
|
||||||
QuickTestTreeItem *copied = new QuickTestTreeItem;
|
QuickTestTreeItem *copied = new QuickTestTreeItem(framework());
|
||||||
copied->copyBasicDataFrom(this);
|
copied->copyBasicDataFrom(this);
|
||||||
return copied;
|
return copied;
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@ TestConfiguration *QuickTestTreeItem::testConfiguration() const
|
|||||||
if (child->type() == TestTreeItem::TestFunction)
|
if (child->type() == TestTreeItem::TestFunction)
|
||||||
testFunctions << testName + "::" + child->name();
|
testFunctions << testName + "::" + child->name();
|
||||||
});
|
});
|
||||||
config = new QuickTestConfiguration;
|
config = new QuickTestConfiguration(framework());
|
||||||
config->setTestCases(testFunctions);
|
config->setTestCases(testFunctions);
|
||||||
config->setProjectFile(proFile());
|
config->setProjectFile(proFile());
|
||||||
config->setProject(project);
|
config->setProject(project);
|
||||||
@@ -146,7 +146,7 @@ TestConfiguration *QuickTestTreeItem::testConfiguration() const
|
|||||||
case TestFunction: {
|
case TestFunction: {
|
||||||
TestTreeItem *parent = parentItem();
|
TestTreeItem *parent = parentItem();
|
||||||
QStringList testFunction(parent->name() + "::" + name());
|
QStringList testFunction(parent->name() + "::" + name());
|
||||||
config = new QuickTestConfiguration;
|
config = new QuickTestConfiguration(framework());
|
||||||
config->setTestCases(testFunction);
|
config->setTestCases(testFunction);
|
||||||
config->setProjectFile(parent->proFile());
|
config->setProjectFile(parent->proFile());
|
||||||
config->setProject(project);
|
config->setProject(project);
|
||||||
@@ -186,7 +186,7 @@ static void testConfigurationFromCheckState(const TestTreeItem *item,
|
|||||||
oldFunctions << testFunctions;
|
oldFunctions << testFunctions;
|
||||||
tc->setTestCases(oldFunctions);
|
tc->setTestCases(oldFunctions);
|
||||||
} else {
|
} else {
|
||||||
tc = new QuickTestConfiguration;
|
tc = new QuickTestConfiguration(item->framework());
|
||||||
tc->setTestCases(testFunctions);
|
tc->setTestCases(testFunctions);
|
||||||
tc->setProjectFile(item->proFile());
|
tc->setProjectFile(item->proFile());
|
||||||
tc->setProject(ProjectExplorer::SessionManager::startupProject());
|
tc->setProject(ProjectExplorer::SessionManager::startupProject());
|
||||||
@@ -244,7 +244,7 @@ QList<TestConfiguration *> QuickTestTreeItem::getAllTestConfigurations() const
|
|||||||
});
|
});
|
||||||
// create TestConfiguration for each project file
|
// create TestConfiguration for each project file
|
||||||
for (auto it = testsForProfile.begin(), end = testsForProfile.end(); it != end; ++it) {
|
for (auto it = testsForProfile.begin(), end = testsForProfile.end(); it != end; ++it) {
|
||||||
QuickTestConfiguration *tc = new QuickTestConfiguration;
|
QuickTestConfiguration *tc = new QuickTestConfiguration(framework());
|
||||||
tc->setTestCaseCount(it.value().testCount);
|
tc->setTestCaseCount(it.value().testCount);
|
||||||
tc->setProjectFile(it.key());
|
tc->setProjectFile(it.key());
|
||||||
tc->setProject(project);
|
tc->setProject(project);
|
||||||
@@ -404,7 +404,7 @@ TestTreeItem *QuickTestTreeItem::createParentGroupNode() const
|
|||||||
{
|
{
|
||||||
const QFileInfo fileInfo(filePath());
|
const QFileInfo fileInfo(filePath());
|
||||||
const QFileInfo base(fileInfo.absolutePath());
|
const QFileInfo base(fileInfo.absolutePath());
|
||||||
return new QuickTestTreeItem(base.baseName(), fileInfo.absolutePath(), TestTreeItem::GroupNode);
|
return new QuickTestTreeItem(framework(), base.baseName(), fileInfo.absolutePath(), TestTreeItem::GroupNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QuickTestTreeItem::isGroupable() const
|
bool QuickTestTreeItem::isGroupable() const
|
||||||
|
@@ -33,8 +33,12 @@ namespace Internal {
|
|||||||
class QuickTestTreeItem : public TestTreeItem
|
class QuickTestTreeItem : public TestTreeItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit QuickTestTreeItem(const QString &name = QString(), const QString &filePath = QString(),
|
explicit QuickTestTreeItem(ITestFramework *framework,
|
||||||
Type type = Root) : TestTreeItem(name, filePath, type) {}
|
const QString &name = QString(),
|
||||||
|
const QString &filePath = QString(),
|
||||||
|
Type type = Root)
|
||||||
|
: TestTreeItem(framework, name, filePath, type)
|
||||||
|
{}
|
||||||
|
|
||||||
TestTreeItem *copyWithoutChildren() override;
|
TestTreeItem *copyWithoutChildren() override;
|
||||||
QVariant data(int column, int role) const override;
|
QVariant data(int column, int role) const override;
|
||||||
|
@@ -49,6 +49,11 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
|
|
||||||
|
TestConfiguration::TestConfiguration(ITestFramework *framework)
|
||||||
|
: m_framework(framework)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
TestConfiguration::~TestConfiguration()
|
TestConfiguration::~TestConfiguration()
|
||||||
{
|
{
|
||||||
m_testCases.clear();
|
m_testCases.clear();
|
||||||
@@ -351,4 +356,9 @@ bool TestConfiguration::hasExecutable() const
|
|||||||
return !m_runnable.executable.isEmpty();
|
return !m_runnable.executable.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ITestFramework *TestConfiguration::framework() const
|
||||||
|
{
|
||||||
|
return m_framework;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Autotest
|
} // namespace Autotest
|
||||||
|
@@ -45,6 +45,7 @@ namespace Internal {
|
|||||||
class TestRunConfiguration;
|
class TestRunConfiguration;
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
|
class ITestFramework;
|
||||||
class TestOutputReader;
|
class TestOutputReader;
|
||||||
class TestResult;
|
class TestResult;
|
||||||
enum class TestRunMode;
|
enum class TestRunMode;
|
||||||
@@ -54,7 +55,7 @@ using TestResultPtr = QSharedPointer<TestResult>;
|
|||||||
class TestConfiguration
|
class TestConfiguration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TestConfiguration() = default;
|
explicit TestConfiguration(ITestFramework *framework);
|
||||||
virtual ~TestConfiguration();
|
virtual ~TestConfiguration();
|
||||||
|
|
||||||
void completeTestInformation(TestRunMode runMode);
|
void completeTestInformation(TestRunMode runMode);
|
||||||
@@ -73,6 +74,7 @@ public:
|
|||||||
void setInternalTargets(const QSet<QString> &targets);
|
void setInternalTargets(const QSet<QString> &targets);
|
||||||
void setOriginalRunConfiguration(ProjectExplorer::RunConfiguration *runConfig);
|
void setOriginalRunConfiguration(ProjectExplorer::RunConfiguration *runConfig);
|
||||||
|
|
||||||
|
ITestFramework *framework() const;
|
||||||
QStringList testCases() const { return m_testCases; }
|
QStringList testCases() const { return m_testCases; }
|
||||||
int testCaseCount() const { return m_testCaseCount; }
|
int testCaseCount() const { return m_testCaseCount; }
|
||||||
QString executableFilePath() const;
|
QString executableFilePath() const;
|
||||||
@@ -95,7 +97,9 @@ public:
|
|||||||
QProcess *app) const = 0;
|
QProcess *app) const = 0;
|
||||||
virtual QStringList argumentsForTestRunner(QStringList *omitted = nullptr) const = 0;
|
virtual QStringList argumentsForTestRunner(QStringList *omitted = nullptr) const = 0;
|
||||||
virtual Utils::Environment filteredEnvironment(const Utils::Environment &original) const = 0;
|
virtual Utils::Environment filteredEnvironment(const Utils::Environment &original) const = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
ITestFramework *m_framework;
|
||||||
QStringList m_testCases;
|
QStringList m_testCases;
|
||||||
int m_testCaseCount = 0;
|
int m_testCaseCount = 0;
|
||||||
QString m_projectFile;
|
QString m_projectFile;
|
||||||
@@ -113,8 +117,8 @@ private:
|
|||||||
class DebuggableTestConfiguration : public TestConfiguration
|
class DebuggableTestConfiguration : public TestConfiguration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit DebuggableTestConfiguration(TestRunMode runMode = TestRunMode::Run)
|
explicit DebuggableTestConfiguration(ITestFramework *framework, TestRunMode runMode = TestRunMode::Run)
|
||||||
: m_runMode(runMode) {}
|
: TestConfiguration(framework), m_runMode(runMode) {}
|
||||||
|
|
||||||
void setRunMode(TestRunMode mode) { m_runMode = mode; }
|
void setRunMode(TestRunMode mode) { m_runMode = mode; }
|
||||||
TestRunMode runMode() const { return m_runMode; }
|
TestRunMode runMode() const { return m_runMode; }
|
||||||
|
@@ -120,14 +120,6 @@ ITestFramework *TestFrameworkManager::frameworkForId(Id frameworkId)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
IFrameworkSettings *TestFrameworkManager::settingsForTestFramework(
|
|
||||||
const Id &frameworkId) const
|
|
||||||
{
|
|
||||||
ITestFramework *framework = frameworkForId(frameworkId);
|
|
||||||
QTC_ASSERT(framework, return nullptr);
|
|
||||||
return framework->frameworkSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestFrameworkManager::synchronizeSettings(QSettings *s)
|
void TestFrameworkManager::synchronizeSettings(QSettings *s)
|
||||||
{
|
{
|
||||||
Internal::AutotestPlugin::settings()->fromSettings(s);
|
Internal::AutotestPlugin::settings()->fromSettings(s);
|
||||||
|
@@ -61,7 +61,6 @@ public:
|
|||||||
TestFrameworks sortedRegisteredFrameworks() const;
|
TestFrameworks sortedRegisteredFrameworks() const;
|
||||||
TestFrameworks sortedActiveFrameworks() const;
|
TestFrameworks sortedActiveFrameworks() const;
|
||||||
|
|
||||||
IFrameworkSettings *settingsForTestFramework(const Core::Id &frameworkId) const;
|
|
||||||
void synchronizeSettings(QSettings *s);
|
void synchronizeSettings(QSettings *s);
|
||||||
bool hasActiveFrameworks() const;
|
bool hasActiveFrameworks() const;
|
||||||
|
|
||||||
|
@@ -38,8 +38,10 @@
|
|||||||
|
|
||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
|
|
||||||
TestTreeItem::TestTreeItem(const QString &name, const QString &filePath, Type type)
|
TestTreeItem::TestTreeItem(ITestFramework *framework, const QString &name,
|
||||||
: m_name(name),
|
const QString &filePath, Type type)
|
||||||
|
: m_framework(framework),
|
||||||
|
m_name(name),
|
||||||
m_filePath(filePath),
|
m_filePath(filePath),
|
||||||
m_type(type)
|
m_type(type)
|
||||||
{
|
{
|
||||||
@@ -355,6 +357,11 @@ inline bool TestTreeItem::modifyName(const QString &name)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ITestFramework *TestTreeItem::framework() const
|
||||||
|
{
|
||||||
|
return m_framework;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* try to find build system target that depends on the given file - if the file is no header
|
* try to find build system target that depends on the given file - if the file is no header
|
||||||
* try to find the corresponding header and use this instead to find the respective target
|
* try to find the corresponding header and use this instead to find the respective target
|
||||||
|
@@ -46,6 +46,7 @@ namespace Utils { class FilePath; }
|
|||||||
|
|
||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
|
|
||||||
|
class ITestFramework;
|
||||||
class TestConfiguration;
|
class TestConfiguration;
|
||||||
class TestParseResult;
|
class TestParseResult;
|
||||||
enum class TestRunMode;
|
enum class TestRunMode;
|
||||||
@@ -71,7 +72,9 @@ public:
|
|||||||
Naturally
|
Naturally
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit TestTreeItem(const QString &name = QString(), const QString &filePath = QString(),
|
explicit TestTreeItem(ITestFramework *framework,
|
||||||
|
const QString &name = QString(),
|
||||||
|
const QString &filePath = QString(),
|
||||||
Type type = Root);
|
Type type = Root);
|
||||||
|
|
||||||
virtual TestTreeItem *copyWithoutChildren() = 0;
|
virtual TestTreeItem *copyWithoutChildren() = 0;
|
||||||
@@ -83,6 +86,7 @@ public:
|
|||||||
bool modifyDataTagContent(const TestParseResult *result);
|
bool modifyDataTagContent(const TestParseResult *result);
|
||||||
bool modifyLineAndColumn(const TestParseResult *result);
|
bool modifyLineAndColumn(const TestParseResult *result);
|
||||||
|
|
||||||
|
ITestFramework *framework() const;
|
||||||
const QString name() const { return m_name; }
|
const QString name() const { return m_name; }
|
||||||
void setName(const QString &name) { m_name = name; }
|
void setName(const QString &name) { m_name = name; }
|
||||||
const QString filePath() const { return m_filePath; }
|
const QString filePath() const { return m_filePath; }
|
||||||
@@ -129,6 +133,7 @@ public:
|
|||||||
// decide whether an item should still be added to the treemodel
|
// decide whether an item should still be added to the treemodel
|
||||||
virtual bool shouldBeAddedAfterFiltering() const { return true; }
|
virtual bool shouldBeAddedAfterFiltering() const { return true; }
|
||||||
virtual QSet<QString> internalTargets() const;
|
virtual QSet<QString> internalTargets() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void copyBasicDataFrom(const TestTreeItem *other);
|
void copyBasicDataFrom(const TestTreeItem *other);
|
||||||
typedef std::function<bool(const TestTreeItem *)> CompareFunction;
|
typedef std::function<bool(const TestTreeItem *)> CompareFunction;
|
||||||
@@ -146,6 +151,7 @@ private:
|
|||||||
Cleared
|
Cleared
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ITestFramework *m_framework = nullptr;
|
||||||
QString m_name;
|
QString m_name;
|
||||||
QString m_filePath;
|
QString m_filePath;
|
||||||
Qt::CheckState m_checked;
|
Qt::CheckState m_checked;
|
||||||
|
Reference in New Issue
Block a user