2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2016-06-01 16:22:50 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2020-10-09 13:07:55 +02:00
|
|
|
#include <utils/id.h>
|
2016-06-01 16:22:50 +02:00
|
|
|
|
2020-10-19 13:56:19 +02:00
|
|
|
namespace ProjectExplorer { struct TestCaseInfo; }
|
2021-03-24 12:40:03 +01:00
|
|
|
namespace Utils { class AspectContainer; }
|
2020-10-19 13:56:19 +02:00
|
|
|
|
2016-06-01 16:22:50 +02:00
|
|
|
namespace Autotest {
|
|
|
|
|
|
2020-10-19 13:56:19 +02:00
|
|
|
class ITestFramework;
|
2020-10-09 13:07:55 +02:00
|
|
|
class ITestParser;
|
2021-03-24 12:40:03 +01:00
|
|
|
using ITestSettings = Utils::AspectContainer;
|
2020-10-19 13:56:19 +02:00
|
|
|
class ITestTool;
|
|
|
|
|
class ITestTreeItem;
|
2020-10-09 13:07:55 +02:00
|
|
|
class TestTreeItem;
|
2016-10-05 12:39:23 +02:00
|
|
|
|
2020-10-06 14:02:29 +02:00
|
|
|
class ITestBase
|
2016-06-01 16:22:50 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2020-10-19 14:46:21 +02:00
|
|
|
enum TestBaseType
|
|
|
|
|
{
|
|
|
|
|
None = 0x0,
|
|
|
|
|
Framework = 0x1,
|
|
|
|
|
Tool = 0x2
|
|
|
|
|
};
|
|
|
|
|
|
2020-11-25 08:18:55 +01:00
|
|
|
explicit ITestBase(bool activeByDefault, const TestBaseType type);
|
2020-10-06 14:02:29 +02:00
|
|
|
virtual ~ITestBase() = default;
|
2016-06-01 16:22:50 +02:00
|
|
|
|
|
|
|
|
virtual const char *name() const = 0;
|
2022-06-09 15:02:30 +02:00
|
|
|
virtual QString displayName() const = 0;
|
2016-06-01 16:22:50 +02:00
|
|
|
virtual unsigned priority() const = 0; // should this be modifyable?
|
2020-11-25 08:18:55 +01:00
|
|
|
TestBaseType type() const { return m_type; }
|
2020-03-12 13:58:09 +01:00
|
|
|
|
2020-10-06 14:31:31 +02:00
|
|
|
virtual ITestSettings *testSettings() { return nullptr; }
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
Utils::Id settingsId() const;
|
|
|
|
|
Utils::Id id() const;
|
2020-03-13 12:16:26 +01:00
|
|
|
|
2016-06-06 15:35:00 +02:00
|
|
|
bool active() const { return m_active; }
|
|
|
|
|
void setActive(bool active) { m_active = active; }
|
2020-10-06 14:02:29 +02:00
|
|
|
|
|
|
|
|
void resetRootNode();
|
|
|
|
|
|
2020-10-19 13:56:19 +02:00
|
|
|
virtual ITestFramework *asFramework() { return nullptr; }
|
|
|
|
|
virtual ITestTool *asTestTool() { return nullptr; }
|
|
|
|
|
|
2020-10-06 14:02:29 +02:00
|
|
|
protected:
|
2020-10-19 13:56:19 +02:00
|
|
|
virtual ITestTreeItem *createRootNode() = 0;
|
2020-10-06 14:02:29 +02:00
|
|
|
|
|
|
|
|
private:
|
2020-10-19 13:56:19 +02:00
|
|
|
ITestTreeItem *m_rootNode = nullptr;
|
2020-10-06 14:02:29 +02:00
|
|
|
bool m_active = false;
|
2020-11-25 08:18:55 +01:00
|
|
|
TestBaseType m_type = None;
|
2020-10-19 13:56:19 +02:00
|
|
|
|
|
|
|
|
friend class ITestFramework;
|
|
|
|
|
friend class ITestTool;
|
2020-10-06 14:02:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class ITestFramework : public ITestBase
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit ITestFramework(bool activeByDefault);
|
|
|
|
|
~ITestFramework() override;
|
|
|
|
|
|
2020-10-19 13:56:19 +02:00
|
|
|
TestTreeItem *rootNode();
|
2020-10-06 14:02:29 +02:00
|
|
|
ITestParser *testParser();
|
|
|
|
|
|
2017-12-06 08:45:36 +01:00
|
|
|
bool grouping() const { return m_grouping; }
|
|
|
|
|
void setGrouping(bool group) { m_grouping = group; }
|
2018-03-13 10:04:46 +01:00
|
|
|
// framework specific tool tip to be displayed on the general settings page
|
|
|
|
|
virtual QString groupingToolTip() const { return QString(); }
|
2020-03-16 12:59:23 +01:00
|
|
|
|
2020-10-19 13:56:19 +02:00
|
|
|
ITestFramework *asFramework() final { return this; }
|
|
|
|
|
|
2016-06-01 16:22:50 +02:00
|
|
|
protected:
|
2020-03-13 13:54:33 +01:00
|
|
|
virtual ITestParser *createTestParser() = 0;
|
2016-06-01 16:22:50 +02:00
|
|
|
|
|
|
|
|
private:
|
2018-05-31 07:38:04 +02:00
|
|
|
ITestParser *m_testParser = nullptr;
|
2017-12-06 08:45:36 +01:00
|
|
|
bool m_grouping = false;
|
2016-06-01 16:22:50 +02:00
|
|
|
};
|
|
|
|
|
|
2020-03-13 13:54:33 +01:00
|
|
|
using TestFrameworks = QList<ITestFramework *>;
|
|
|
|
|
|
2020-10-19 13:56:19 +02:00
|
|
|
class ITestTool : public ITestBase
|
|
|
|
|
{
|
|
|
|
|
public:
|
2020-11-25 08:18:55 +01:00
|
|
|
explicit ITestTool(bool activeByDefault);
|
2020-10-19 13:56:19 +02:00
|
|
|
|
|
|
|
|
ITestTreeItem *rootNode();
|
|
|
|
|
|
|
|
|
|
virtual Utils::Id buildSystemId() const = 0;
|
|
|
|
|
|
|
|
|
|
virtual ITestTreeItem *createItemFromTestCaseInfo(const ProjectExplorer::TestCaseInfo &tci) = 0;
|
|
|
|
|
|
|
|
|
|
ITestTool *asTestTool() final { return this; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
unsigned priority() const final { return 255; }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using TestTools = QList<ITestTool *>;
|
|
|
|
|
|
2016-06-01 16:22:50 +02:00
|
|
|
} // namespace Autotest
|