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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user