Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot with dialog
SWTBot with dialog [message #692876] Tue, 05 July 2011 11:48 Go to next message
dengtao  is currently offline dengtao
Messages: 2
Registered: July 2011
Junior Member
Hi All:
I use SWTBot to test our product.And All My Test works fine on my machine!
Now I move the build to Hudson(use another machine),All my Test goes fine except one.
The failed TestCase need to open a dialog,code:

.....
bot = new SWTWorkbenchBot();
//find view
SWTBot viewbot = bot.viewById(DrugUsedbfxView.ID).bot();
//find text and trigger "enter" will show the dialog
viewbot.textWithId("txtYpbh").pressShortcut(SWT.CR, SWT.LF);

SWTBotShell shellbot = bot.shell("shell name");
shellbot.activate();
bot.buttonWithId("okBtn").click();
.....

When I open the RDP,the case can pass,I close the RDP or minimum the RDP,the case goes wrong.

Re: SWTBot with dialog [message #692877 is a reply to message #692876] Tue, 05 July 2011 11:51 Go to previous messageGo to next message
dengtao  is currently offline dengtao
Messages: 2
Registered: July 2011
Junior Member
Exception:

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.ztkj.his.zhcx.test.ZhcxMzTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.062 sec
Running com.ztkj.his.zhcx.test.ZhcxZyTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.ztkj.his.zhcx.test.ZhcxWzTest
log4j:WARN No appenders could be found for logger (org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher).
log4j:WARN Please initialize the log4j system properly.
Tests run: 17, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 16.593 sec <<< FAILURE!
testDbfx(com.ztkj.his.zhcx.test.ZhcxWzTest) Time elapsed: 5.734 sec <<< ERROR!
org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException: Could not find widget.
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetAppears(SWTBotFactory.java:348)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.shells(SWTBotFactory.java:112)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.shell(SWTBotFactory.java:102)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.shell(SWTBotFactory.java:93)
at com.ztkj.his.zhcx.test.ZhcxWzTest.testDbfx(ZhcxWzTest.java:231)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:72)
at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication.runTests(AbstractUITestApplication.java:44)
at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(WorkbenchTestable.java:71)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.eclipse.swtbot.swt.finder.widgets.TimeoutException: Timeout after: 5000 ms.: Could not find shell matching: with text '药品资料'
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:398)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:372)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:360)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetAppears(SWTBotFactory.java:346)
... 29 more
Re: SWTBot with dialog [message #694265 is a reply to message #692876] Fri, 08 July 2011 08:27 Go to previous message
Benjamin Ratiarisolo is currently offline Benjamin Ratiarisolo
Messages: 16
Registered: January 2010
Location: Paris, France
Junior Member
This reminds me of a similar issue I had when deploying our SWTBot test suites to our continuous integration framework (I am using windows as OS on my development platform while the continuous integration servers usually run on Linux).

I had to specifically set the SWTBot keyboard layouts property for keyboard-shortcut based tests to successfully run in the continuous integration environment: I added '-Dorg.eclipse.swtbot.keyboard.layout=EN_US' in the vmargs property of the swtbot-test ANT task. It seemed to work fine for me then.

You can give it a try.


--
Benjamin Ratiarisolo
IBM ODM Decision Server Rules - Software Developer
IBM Software - France Lab
Previous Topic:"Confirm Disable Builder" Dialog -how to access?
Next Topic:How can I properly select a radio button using SWTBot?
Goto Forum:
  


Current Time: Sat Sep 20 22:18:51 GMT 2014

Powered by FUDForum. Page generated in 0.01743 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software