2014-10-07 15:51:02 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2014-10-07 15:51:02 +02:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** This file is part of Qt Creator.
|
2014-10-07 15:51:02 +02:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
2014-10-07 15:51:02 +02:00
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-22 10:37:55 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2014-10-07 15:51:02 +02:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2014-10-07 15:51:02 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
#include "testconfiguration.h"
|
|
|
|
|
#include "testresult.h"
|
|
|
|
|
|
2016-01-19 14:24:09 +01:00
|
|
|
#include <QFutureWatcher>
|
2014-10-07 15:51:02 +02:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QProcess>
|
|
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
class Project;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class TestRunner : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2016-06-15 12:29:24 +02:00
|
|
|
enum Mode
|
|
|
|
|
{
|
|
|
|
|
Run,
|
2016-06-27 11:07:16 +02:00
|
|
|
RunWithoutDeploy,
|
|
|
|
|
Debug,
|
|
|
|
|
DebugWithoutDeploy
|
2016-06-15 12:29:24 +02:00
|
|
|
};
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
static TestRunner* instance();
|
|
|
|
|
~TestRunner();
|
|
|
|
|
|
|
|
|
|
void setSelectedTests(const QList<TestConfiguration *> &selected);
|
2014-11-06 10:48:17 +01:00
|
|
|
bool isTestRunning() const { return m_executingTests; }
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2016-06-28 22:38:54 +03:00
|
|
|
void prepareToRunTests(Mode mode);
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
signals:
|
2014-11-03 08:30:22 +01:00
|
|
|
void testRunStarted();
|
|
|
|
|
void testRunFinished();
|
2015-01-13 11:24:41 +01:00
|
|
|
void requestStopTestRun();
|
2016-02-25 13:02:31 +01:00
|
|
|
void testResultReady(const TestResultPtr &result);
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2016-06-28 22:38:54 +03:00
|
|
|
private:
|
2014-10-07 15:51:02 +02:00
|
|
|
void buildProject(ProjectExplorer::Project *project);
|
|
|
|
|
void buildFinished(bool success);
|
2014-11-06 10:48:17 +01:00
|
|
|
void onFinished();
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2015-06-29 09:22:58 +02:00
|
|
|
void runTests();
|
2016-06-15 12:29:24 +02:00
|
|
|
void debugTests();
|
|
|
|
|
void runOrDebugTests();
|
2014-10-07 15:51:02 +02:00
|
|
|
explicit TestRunner(QObject *parent = 0);
|
|
|
|
|
|
2016-02-25 13:02:31 +01:00
|
|
|
QFutureWatcher<TestResultPtr> m_futureWatcher;
|
2014-10-07 15:51:02 +02:00
|
|
|
QList<TestConfiguration *> m_selectedTests;
|
2014-11-06 10:48:17 +01:00
|
|
|
bool m_executingTests;
|
2016-06-15 12:29:24 +02:00
|
|
|
Mode m_runMode = Run;
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2015-06-29 09:22:58 +02:00
|
|
|
// temporarily used if building before running is necessary
|
|
|
|
|
QMetaObject::Connection m_buildConnect;
|
2014-10-07 15:51:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|