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:
Christian Stenger
2020-09-11 14:30:15 +02:00
parent b4987f8fc9
commit 5f22126a79
16 changed files with 276 additions and 4 deletions

View File

@@ -215,7 +215,8 @@ QList<TestConfiguration *> BoostTestTreeItem::getAllTestConfigurations() const
return result;
}
QList<TestConfiguration *> BoostTestTreeItem::getSelectedTestConfigurations() const
QList<TestConfiguration *> BoostTestTreeItem::getTestConfigurations(
std::function<bool(BoostTestTreeItem *)> predicate) const
{
QList<TestConfiguration *> result;
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
@@ -228,13 +229,13 @@ QList<TestConfiguration *> BoostTestTreeItem::getSelectedTestConfigurations() co
};
QHash<QString, BoostTestCases> testCasesForProjectFile;
forAllChildren([&testCasesForProjectFile](TreeItem *it){
forAllChildren([&testCasesForProjectFile, &predicate](TreeItem *it){
auto item = static_cast<BoostTestTreeItem *>(it);
if (item->type() != TestCase)
return;
if (!item->enabled()) // ignore child tests known to be disabled when using run selected
return;
if (item->checked() == Qt::Checked) {
if (predicate(item)) {
QString tcName = item->name();
if (item->state().testFlag(BoostTestTreeItem::Templated))
tcName.append("<*");
@@ -261,6 +262,20 @@ QList<TestConfiguration *> BoostTestTreeItem::getSelectedTestConfigurations() co
return result;
}
QList<TestConfiguration *> BoostTestTreeItem::getSelectedTestConfigurations() const
{
return getTestConfigurations([](BoostTestTreeItem *it) {
return it->checked() == Qt::Checked;
});
}
QList<TestConfiguration *> BoostTestTreeItem::getFailedTestConfigurations() const
{
return getTestConfigurations([](BoostTestTreeItem *it) {
return it->data(0, FailedRole).toBool();
});
}
TestConfiguration *BoostTestTreeItem::testConfiguration() const
{
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();