forked from qt-creator/qt-creator
AutoTest: Allow grouping of results by application
Add an option to group test results by the application that contains the test cases. Fixes: QTCREATORBUG-21740 Change-Id: If4e5c8118cd5dd81b1b75891b4eca85b08e76848 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -55,6 +55,8 @@ TestResult::TestResult(const QString &id, const QString &name)
|
||||
|
||||
const QString TestResult::outputString(bool selected) const
|
||||
{
|
||||
if (m_result == Result::Application)
|
||||
return m_id;
|
||||
return selected ? m_description : m_description.split('\n').first();
|
||||
}
|
||||
|
||||
@@ -145,6 +147,7 @@ QString TestResult::resultToString(const Result::Type type)
|
||||
case Result::BlacklistedXFail:
|
||||
return QString("BXFAIL");
|
||||
case Result::MessageLocation:
|
||||
case Result::Application:
|
||||
return QString();
|
||||
default:
|
||||
if (type >= Result::INTERNAL_MESSAGES_BEGIN && type <= Result::INTERNAL_MESSAGES_END)
|
||||
|
@@ -67,6 +67,8 @@ enum Type {
|
||||
MessageIntermediate,
|
||||
MessageCurrentTest, INTERNAL_MESSAGES_END = MessageCurrentTest,
|
||||
|
||||
Application,
|
||||
|
||||
Invalid,
|
||||
LAST_TYPE = Invalid
|
||||
};
|
||||
|
@@ -24,9 +24,12 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "autotesticons.h"
|
||||
#include "autotestplugin.h"
|
||||
#include "testresultdelegate.h"
|
||||
#include "testresultmodel.h"
|
||||
#include "testsettings.h"
|
||||
|
||||
#include <projectexplorer/projectexplorericons.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QFontMetrics>
|
||||
@@ -62,6 +65,7 @@ static QIcon testResultIcon(Result::Type result) {
|
||||
QIcon(),
|
||||
Icons::RESULT_MESSAGEPASSWARN.icon(),
|
||||
Icons::RESULT_MESSAGEFAILWARN.icon(),
|
||||
ProjectExplorer::Icons::DESKTOP_DEVICE.icon(), // for now
|
||||
}; // provide an icon for unknown??
|
||||
|
||||
if (result < 0 || result >= Result::MessageInternal) {
|
||||
@@ -74,6 +78,8 @@ static QIcon testResultIcon(Result::Type result) {
|
||||
return icons[16];
|
||||
case Result::MessageTestCaseFailWarn:
|
||||
return icons[17];
|
||||
case Result::Application:
|
||||
return icons[18];
|
||||
default:
|
||||
return QIcon();
|
||||
}
|
||||
@@ -224,7 +230,32 @@ void TestResultModel::addTestResult(const TestResultPtr &testResult, bool autoEx
|
||||
m_testResultCount[testResult->result()]++;
|
||||
|
||||
TestResultItem *newItem = new TestResultItem(testResult);
|
||||
TestResultItem *parentItem = findParentItemFor(newItem);
|
||||
|
||||
TestResultItem *root = nullptr;
|
||||
if (AutotestPlugin::settings()->displayApplication) {
|
||||
const QString application = testResult->id();
|
||||
if (!application.isEmpty()) {
|
||||
for (int row = rootItem()->childCount() - 1; row >= 0; --row) {
|
||||
TestResultItem *tmp = static_cast<TestResultItem *>(rootItem()->childAt(row));
|
||||
auto tmpTestResult = tmp->testResult();
|
||||
if (tmpTestResult->id() == application) {
|
||||
root = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!root) {
|
||||
TestResult *tmpAppResult = new TestResult(application, application);
|
||||
tmpAppResult->setResult(Result::Application);
|
||||
root = new TestResultItem(TestResultPtr(tmpAppResult));
|
||||
if (lastRow >= 0)
|
||||
rootItem()->insertChild(lastRow, root);
|
||||
else
|
||||
rootItem()->appendChild(root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TestResultItem *parentItem = findParentItemFor(newItem, root);
|
||||
addFileName(testResult->fileName()); // ensure we calculate the results pane correctly
|
||||
if (parentItem) {
|
||||
parentItem->appendChild(newItem);
|
||||
@@ -373,7 +404,7 @@ void TestResultFilterModel::enableAllResultTypes()
|
||||
<< Result::MessageTestCaseSuccess << Result::MessageTestCaseSuccessWarn
|
||||
<< Result::MessageTestCaseFail << Result::MessageTestCaseFailWarn
|
||||
<< Result::MessageTestCaseEnd
|
||||
<< Result::MessageInfo << Result::MessageSystem;
|
||||
<< Result::MessageInfo << Result::MessageSystem << Result::Application;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
|
@@ -42,6 +42,7 @@ static const char autoScrollKey[] = "AutoScrollResults";
|
||||
static const char filterScanKey[] = "FilterScan";
|
||||
static const char filtersKey[] = "WhiteListFilters";
|
||||
static const char processArgsKey[] = "ProcessArgs";
|
||||
static const char displayApplicationKey[] = "DisplayApp";
|
||||
static const char groupSuffix[] = ".group";
|
||||
|
||||
constexpr int defaultTimeout = 60000;
|
||||
@@ -60,6 +61,7 @@ void TestSettings::toSettings(QSettings *s) const
|
||||
s->setValue(limitResultOutputKey, limitResultOutput);
|
||||
s->setValue(autoScrollKey, autoScroll);
|
||||
s->setValue(processArgsKey, processArgs);
|
||||
s->setValue(displayApplicationKey, displayApplication);
|
||||
s->setValue(filterScanKey, filterScan);
|
||||
s->setValue(filtersKey, whiteListFilters);
|
||||
// store frameworks and their current active and grouping state
|
||||
@@ -79,6 +81,7 @@ void TestSettings::fromSettings(QSettings *s)
|
||||
limitResultOutput = s->value(limitResultOutputKey, true).toBool();
|
||||
autoScroll = s->value(autoScrollKey, true).toBool();
|
||||
processArgs = s->value(processArgsKey, false).toBool();
|
||||
displayApplication = s->value(displayApplicationKey, false).toBool();
|
||||
filterScan = s->value(filterScanKey, false).toBool();
|
||||
whiteListFilters = s->value(filtersKey, QStringList()).toStringList();
|
||||
// try to get settings for registered frameworks
|
||||
|
@@ -49,6 +49,7 @@ struct TestSettings
|
||||
bool autoScroll = true;
|
||||
bool filterScan = false;
|
||||
bool processArgs = false;
|
||||
bool displayApplication = false;
|
||||
QHash<Core::Id, bool> frameworks;
|
||||
QHash<Core::Id, bool> frameworksGrouping;
|
||||
QStringList whiteListFilters;
|
||||
|
@@ -152,6 +152,7 @@ void TestSettingsWidget::setSettings(const TestSettings &settings)
|
||||
m_ui.limitResultOutputCB->setChecked(settings.limitResultOutput);
|
||||
m_ui.autoScrollCB->setChecked(settings.autoScroll);
|
||||
m_ui.processArgsCB->setChecked(settings.processArgs);
|
||||
m_ui.displayAppCB->setChecked(settings.displayApplication);
|
||||
m_ui.filterGroupBox->setChecked(settings.filterScan);
|
||||
populateFrameworksListWidget(settings.frameworks);
|
||||
populateFiltersWidget(settings.whiteListFilters);
|
||||
@@ -166,6 +167,7 @@ TestSettings TestSettingsWidget::settings() const
|
||||
result.limitResultOutput = m_ui.limitResultOutputCB->isChecked();
|
||||
result.autoScroll = m_ui.autoScrollCB->isChecked();
|
||||
result.processArgs = m_ui.processArgsCB->isChecked();
|
||||
result.displayApplication = m_ui.displayAppCB->isChecked();
|
||||
result.filterScan = m_ui.filterGroupBox->isChecked();
|
||||
frameworkSettings(result);
|
||||
result.whiteListFilters = filters();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>585</width>
|
||||
<height>431</height>
|
||||
<height>458</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -73,6 +73,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="displayAppCB">
|
||||
<property name="text">
|
||||
<string>Group results by application</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="processArgsCB">
|
||||
<property name="toolTip">
|
||||
|
Reference in New Issue
Block a user