Skip to content

Commit 2f40dd2

Browse files
authored
Flaky test management (#228)
* cancel job when Open Blocked Dialog is here for too long * reuse existing helper method
1 parent 155ad70 commit 2f40dd2

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

framework/xdsml_framework/tests/org.eclipse.gemoc.xdsmlframework.test.lib/src/org/eclipse/gemoc/xdsmlframework/test/lib/SWTBotHelper.xtend

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,27 @@ class SWTBotHelper {
3232

3333

3434
/**
35-
* relaunch the waitForJobs several times in case some other background task
36-
* also wait for idle time to triggers new jobs
35+
* print the list of shell known by swtbot
3736
*/
3837
static def void printShellList(SWTWorkbenchBot bot) {
3938
val shells = bot.shells.toList
4039
println("SWTBot Known shells("+shells.size+"):")
4140
for (shell : shells) {
42-
println("\t"+shell)
41+
System.out.println('''«shell» - text="«shell.text»" id="«shell.id»"''')
4342
}
4443
}
4544

45+
/**
46+
* Print the shell list using the UI Thread
47+
*/
48+
static def void printShellListUI(SWTWorkbenchBot bot) {
49+
Display.getDefault().syncExec(new Runnable() {
50+
override void run() {
51+
printShellList(bot)
52+
}
53+
});
54+
}
55+
4656
static def void printTreeList(SWTWorkbenchBot bot) {
4757
println("SWTBot tree(" + bot.tree().allItems.size + "):")
4858
for (item : bot.tree().allItems) {

framework/xdsml_framework/tests/org.eclipse.gemoc.xdsmlframework.test.lib/src/org/eclipse/gemoc/xdsmlframework/test/lib/WorkspaceTestHelper.xtend

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ import java.io.ByteArrayInputStream
1414
import java.io.File
1515
import java.net.URL
1616
import java.net.URLClassLoader
17+
import java.nio.file.Files
1718
import java.util.ArrayList
19+
import java.util.Comparator
1820
import java.util.HashSet
1921
import java.util.List
2022
import java.util.Set
@@ -58,8 +60,6 @@ import org.eclipse.xtext.ui.testing.util.IResourcesSetupUtil
5860
import org.eclipse.xtext.ui.testing.util.JavaProjectSetupUtil
5961
import org.junit.Assert
6062
import org.osgi.framework.Bundle
61-
import java.nio.file.Files
62-
import java.util.Comparator
6363

6464
/**
6565
* Class containing helper methods for testing a workspace in a GEMOC Language workbench
@@ -443,7 +443,8 @@ class WorkspaceTestHelper {
443443
if(retry <= 300 && (job.name.contains("Git Repository Change Scanner") ||
444444
job.name.contains("Periodic workspace save") ||
445445
job.name.contains("Workbench Auto-Save Job") ||
446-
job.name.contains("Compacting resource model")
446+
job.name.contains("Compacting resource model") ||
447+
job.name.contains("Open Blocked Dialog")
447448
)) {
448449
println("[waitForJobs] CANCELLING job "+job.name+ " (rule="+job.rule+")")
449450
job.cancel

0 commit comments

Comments
 (0)