Author: jpeterka
Date: 2012-08-07 09:37:43 -0400 (Tue, 07 Aug 2012)
New Revision: 42882
Modified:
trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java
Log:
Dummy ui bot test multiple action added to check stability
Modified:
trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java
===================================================================
---
trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java 2012-08-07
13:29:49 UTC (rev 42881)
+++
trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java 2012-08-07
13:37:43 UTC (rev 42882)
@@ -1,7 +1,8 @@
package org.jboss.tools.dummy.ui.bot.test;
-import static org.junit.Assert.*;
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive;
+import static org.junit.Assert.assertEquals;
import java.io.OutputStreamWriter;
@@ -10,6 +11,8 @@
import org.apache.log4j.PatternLayout;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -22,8 +25,14 @@
@RunWith(SWTBotJunit4ClassRunner.class)
public class DummyTest {
+ static Logger log = Logger.getLogger(DummyTest.class);
+
@BeforeClass
- public static void before() {
+ public static void before() {
+ ConsoleAppender ca = new ConsoleAppender();
+ ca.setWriter(new OutputStreamWriter(System.out));
+ ca.setLayout(new PatternLayout("[%-5p] %t: %m%n"));
+ log.addAppender(ca);
}
@Test
@@ -34,10 +43,24 @@
ca.setLayout(new PatternLayout("[%-5p] %t: %m%n"));
log.addAppender(ca);
+ String pref = "Preferences";
SWTWorkbenchBot bot = new SWTWorkbenchBot();
- bot.menu("Window").menu("Preferences").click();
- assertEquals("Preferences",bot.activeShell().getText());
+ bot.menu("Window").menu(pref).click();
+ bot.waitUntil(shellIsActive(pref), 10000);
+ SWTBotShell shell = bot.shell(pref);
+ assertEquals(pref,shell.getText());
bot.activeShell().close();
+ }
+
+ @Test
+ public void hundredTimes() {
+ for (int i = 0 ; i < 100; i++)
+ dummyTest();
+ }
+
+ @AfterClass
+ public static void after() {
+ SWTWorkbenchBot bot = new SWTWorkbenchBot();
bot.closeAllShells();
}
}
Show replies by date