forked from qt-creator/qt-creator
AutoTest: Support gathering failed tests
Mark test tree items as failed for the last run to be able to re-run them in an easier way. Change-Id: I7ea3dcd16e5a02797d41f13e02b2fa95b857cf5e Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -170,6 +170,14 @@ QList<TestConfiguration *> TestTreeModel::getSelectedTests() const
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<TestConfiguration *> TestTreeModel::getFailedTests() const
|
||||
{
|
||||
QList<TestConfiguration *> result;
|
||||
for (Utils::TreeItem *frameworkRoot : *rootItem())
|
||||
result.append(static_cast<TestTreeItem *>(frameworkRoot)->getFailedTestConfigurations());
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<TestConfiguration *> TestTreeModel::getTestsForFile(const Utils::FilePath &fileName) const
|
||||
{
|
||||
QList<TestConfiguration *> result;
|
||||
@@ -305,6 +313,23 @@ void TestTreeModel::updateCheckStateCache()
|
||||
}
|
||||
}
|
||||
|
||||
bool TestTreeModel::hasFailedTests() const
|
||||
{
|
||||
auto failedItem = rootItem()->findAnyChild([](Utils::TreeItem *it) {
|
||||
return it->data(0, FailedRole).toBool();
|
||||
});
|
||||
return failedItem != nullptr;
|
||||
}
|
||||
|
||||
void TestTreeModel::clearFailedMarks()
|
||||
{
|
||||
for (Utils::TreeItem *rootNode : *rootItem()) {
|
||||
rootNode->forAllChildren([](Utils::TreeItem *child) {
|
||||
child->setData(0, false, FailedRole);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void TestTreeModel::removeFiles(const QStringList &files)
|
||||
{
|
||||
for (const QString &file : files)
|
||||
|
||||
Reference in New Issue
Block a user