Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormwenz2015-12-22 13:24:49 +0000
committermwenz2015-12-22 13:43:36 +0000
commitf7a8facf8a0b1dd24e5cb79a1cbad8bfd1d9eda9 (patch)
tree725c9fea3d594550995c4f8d4edfeeca46577dff
parent45f6a356a2f763ba4b862e3b3ce4b9667cd9eea2 (diff)
downloadorg.eclipse.graphiti-f7a8facf8a0b1dd24e5cb79a1cbad8bfd1d9eda9.tar.gz
org.eclipse.graphiti-f7a8facf8a0b1dd24e5cb79a1cbad8bfd1d9eda9.tar.xz
org.eclipse.graphiti-f7a8facf8a0b1dd24e5cb79a1cbad8bfd1d9eda9.zip
Improve test stability
-rw-r--r--tests/org.eclipse.graphiti.bot.tests/src/org/eclipse/graphiti/bot/tests/PluginWizardTests.java31
1 files changed, 26 insertions, 5 deletions
diff --git a/tests/org.eclipse.graphiti.bot.tests/src/org/eclipse/graphiti/bot/tests/PluginWizardTests.java b/tests/org.eclipse.graphiti.bot.tests/src/org/eclipse/graphiti/bot/tests/PluginWizardTests.java
index dcaa582a..e9488355 100644
--- a/tests/org.eclipse.graphiti.bot.tests/src/org/eclipse/graphiti/bot/tests/PluginWizardTests.java
+++ b/tests/org.eclipse.graphiti.bot.tests/src/org/eclipse/graphiti/bot/tests/PluginWizardTests.java
@@ -63,6 +63,13 @@ public class PluginWizardTests extends AbstractGFTests {
@Test
public void testPluginWizardRun() throws Exception {
+ // Check problems view and remember number of errors before test
+ SWTBotView view = bot.viewById(IPageLayout.ID_PROBLEM_VIEW);
+ view.show();
+ SWTBotTree tree = view.bot().tree();
+ SWTBotTreeItem[] allItems = tree.getAllItems();
+ int numberOfErrorsBeforeTest = allItems.length;
+
// Start wizard
bot.menu("File").menu("New").menu("Project...").click();
SWTBotShell shell = bot.shell("New Project");
@@ -105,11 +112,16 @@ public class PluginWizardTests extends AbstractGFTests {
assertTrue(newProject.exists());
// Check problems view for any errors
- SWTBotView view = bot.viewById(IPageLayout.ID_PROBLEM_VIEW);
- view.show();
- SWTBotTree tree = view.bot().tree();
- SWTBotTreeItem[] allItems = tree.getAllItems();
- assertTrue("Items found in problems view: " + allItems.toString(), allItems.length == 0);
+ allItems = extractAllItemsFromProblemsView();
+ counter = 0;
+ while ((allItems == null || allItems.length != numberOfErrorsBeforeTest) && counter < 20) {
+ counter++;
+ Thread.sleep(1000);
+ allItems = extractAllItemsFromProblemsView();
+ }
+ assertTrue("Items found in problems view: " + allItems.toString()
+ + ", expected were (number of errors before test: " + numberOfErrorsBeforeTest,
+ allItems.length == numberOfErrorsBeforeTest);
// Check that org.eclipse.ui is not part of the dependencies (no
// activator is generated), test for Bug 388211
@@ -126,4 +138,13 @@ public class PluginWizardTests extends AbstractGFTests {
}
}
}
+
+ private SWTBotTreeItem[] extractAllItemsFromProblemsView() {
+ SWTBotTreeItem[] allItems;
+ SWTBotView view = bot.viewById(IPageLayout.ID_PROBLEM_VIEW);
+ view.show();
+ SWTBotTree tree = view.bot().tree();
+ allItems = tree.getAllItems();
+ return allItems;
+ }
}

Back to the top