Commit 44db2be1 authored by Christian Stenger's avatar Christian Stenger Committed by Christian Stenger
Browse files

Provide basic test runner and output pane

parent 2f4139e5
......@@ -15,7 +15,13 @@ SOURCES += \
testvisitor.cpp \
testinfo.cpp \
testcodeparser.cpp \
autotestplugin.cpp
autotestplugin.cpp \
testrunner.cpp \
testconfiguration.cpp \
testresult.cpp \
testresultspane.cpp \
testresultmodel.cpp \
testresultdelegate.cpp
HEADERS += \
testtreeview.h \
......@@ -26,7 +32,13 @@ HEADERS += \
testcodeparser.h \
autotestplugin.h \
autotest_global.h \
autotestconstants.h
autotestconstants.h \
testrunner.h \
testconfiguration.h \
testresult.h \
testresultspane.h \
testresultmodel.h \
testresultdelegate.h
RESOURCES += \
autotest.qrc
......
......@@ -5,5 +5,16 @@
<file>images/expand.png</file>
<file>images/collapse.png</file>
<file>images/sort.png</file>
<file>images/leafsort.png</file>
<file>images/debug.png</file>
<file>images/fail.png</file>
<file>images/fatal.png</file>
<file>images/pass.png</file>
<file>images/skip.png</file>
<file>images/warn.png</file>
<file>images/xfail.png</file>
<file>images/xpass.png</file>
<file>images/run.png</file>
<file>images/runselected.png</file>
</qresource>
</RCC>
......@@ -18,8 +18,10 @@
#include "autotestplugin.h"
#include "autotestconstants.h"
#include "testrunner.h"
#include "testtreeview.h"
#include "testtreemodel.h"
#include "testresultspane.h"
#include <coreplugin/icore.h>
#include <coreplugin/icontext.h>
......@@ -48,6 +50,8 @@ AutotestPlugin::~AutotestPlugin()
// Delete members
TestTreeModel *model = TestTreeModel::instance();
delete model;
TestRunner *runner = TestRunner::instance();
delete runner;
}
bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorString)
......@@ -74,6 +78,7 @@ bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorStri
Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu);
addAutoReleasedObject(new TestViewFactory);
addAutoReleasedObject(TestResultsPane::instance());
return true;
}
......
......@@ -50,8 +50,7 @@ void TestCodeParser::updateTestTree()
TestTreeItem *autoTestRootItem = static_cast<TestTreeItem *>(autoTestRootIndex.internalPointer());
autoTestRootItem->removeChildren();
m_model->endResetModel();
ProjectExplorer::SessionManager *session = static_cast<ProjectExplorer::SessionManager *>(
ProjectExplorer::SessionManager::instance());
ProjectExplorer::SessionManager *session = ProjectExplorer::SessionManager::instance();
if (!session || !session->hasProjects())
return;
......@@ -196,10 +195,10 @@ void TestCodeParser::checkDocumentForTestCode(CPlusPlus::Document::Ptr doc)
m_cppDocMap.insert(file, new TestInfo(tc, privSlots.keys(),
doc->revision(),
doc->editorRevision()));
delete info;
break;
}
}
delete info;
delete ttItem;
} else {
m_model->beginInsertRows(autoTestRootIndex, autoTestRootItem->childCount(), autoTestRootItem->childCount());
......
......@@ -38,7 +38,7 @@ class TestCodeParser : public QObject
{
Q_OBJECT
public:
explicit TestCodeParser(/*QObject*/TestTreeModel *parent = 0);
explicit TestCodeParser(TestTreeModel *parent = 0);
signals:
......
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the Qt Creator Enterprise Auto Test Add-on.
**
** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
**
****************************************************************************/
#include "testconfiguration.h"
#include <projectexplorer/project.h>
namespace Autotest {
namespace Internal {
TestConfiguration::TestConfiguration(const QString &testClass, const QStringList &testCases,
QObject *parent)
: QObject(parent),
m_testClass(testClass),
m_testCases(testCases),
m_project(0)
{
}
TestConfiguration::~TestConfiguration()
{
m_testCases.clear();
}
void TestConfiguration::setTargetFile(const QString &targetFile)
{
m_targetFile = targetFile;
}
void TestConfiguration::setTargetName(const QString &targetName)
{
m_targetName = targetName;
}
void TestConfiguration::setProFile(const QString &proFile)
{
m_proFile = proFile;
}
void TestConfiguration::setWorkingDirectory(const QString &workingDirectory)
{
m_workingDir = workingDirectory;
}
void TestConfiguration::setEnvironment(const Utils::Environment &env)
{
m_environment = env;
}
void TestConfiguration::setProject(ProjectExplorer::Project *project)
{
m_project = project;
}
} // namespace Internal
} // namespace Autotest
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the Qt Creator Enterprise Auto Test Add-on.
**
** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
**
****************************************************************************/
#ifndef TESTCONFIGURATION_H
#define TESTCONFIGURATION_H
#include <utils/environment.h>
#include <QObject>
#include <QStringList>
namespace ProjectExplorer {
class Project;
}
namespace Autotest {
namespace Internal {
class TestConfiguration : public QObject
{
Q_OBJECT
public:
explicit TestConfiguration(const QString &testClass, const QStringList &testCases,
QObject *parent = 0);
~TestConfiguration();
void setTargetFile(const QString &targetFile);
void setTargetName(const QString &targetName);
void setProFile(const QString &proFile);
void setWorkingDirectory(const QString &workingDirectory);
void setEnvironment(const Utils::Environment &env);
void setProject(ProjectExplorer::Project *project);
QString testClass() const { return m_testClass; }
QStringList testCases() const { return m_testCases; }
QString proFile() const { return m_proFile; }
QString targetFile() const { return m_targetFile; }
QString targetName() const { return m_targetName; }
QString workingDirectory() const { return m_workingDir; }
Utils::Environment environment() const { return m_environment; }
ProjectExplorer::Project *project() const { return m_project; }
signals:
public slots:
private:
QString m_testClass;
QStringList m_testCases;
QString m_proFile;
QString m_targetFile;
QString m_targetName;
QString m_workingDir;
Utils::Environment m_environment;
ProjectExplorer::Project *m_project;
};
} // namespace Internal
} // namespace Autotest
#endif // TESTCONFIGURATION_H
......@@ -30,5 +30,10 @@ TestInfo::TestInfo(const QString &className, const QStringList &functions, unsig
{
}
TestInfo::~TestInfo()
{
m_functions.clear();
}
} // namespace Internal
} // namespace Autotest
......@@ -30,6 +30,7 @@ public:
explicit TestInfo(const QString &className, const QStringList &functions = QStringList(),
unsigned revision = 0, unsigned editorRevision = 0);
~TestInfo();
const QString testClass() const { return m_className; }
void setTestClass(const QString &className) { m_className = className; }
const QStringList testFunctions() const { return m_functions; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment