blackle wrote: > I simply opened a File Dialog thro following code,and try to close a button > on that File Dialog. > > FileDialog dlg = new FileDialog(shell, SWT.OPEN); > String fileName = dlg.open(); > if (fileName != null) { > System.out.println(fileName); > } > display.dispose(); > > >
Youca nnot test native widgets like File open Dialog and Message Dialogs with SWTBot Rite Now it has been already discussed on this forum See other Threads at the users List at : http://www.nabble.com/SWTBot-Users-List-f35572.html b bye! > ______________________________________________________________________________________ > and tried foll code to test the above code: > > bot.shell("Open").activate(); > String str=bot.activeShell().getText(); > System.out.println("Active Shell:"+str); > > bot.button("Cancel").click(); > System.out.println("close button clicked"); > > ______________________________________________________________________________________ > Foll. error i get: > > net.sf.swtbot.widgets.WidgetNotFoundException: Could not find widget with > text Open > at net.sf.swtbot.widgets.AbstractSWTBot.<init>(AbstractSWTBot.java:132) > at net.sf.swtbot.widgets.AbstractSWTBot.<init>(AbstractSWTBot.java:98) > at net.sf.swtbot.widgets.SWTBotShell.<init>(SWTBotShell.java:42) > at net.sf.swtbot.SWTBot.shell(SWTBot.java:143) > at step2.FileDialogWin_Test.testOtherClass(FileDialogWin_Test.java:65) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at junit.framework.TestCase.runTest(TestCase.java:164) > at junit.framework.TestCase.runBare(TestCase.java:130) > at net.sf.swtbot.SWTBotTestCase.runBare(SWTBotTestCase.java:234) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:120) > at junit.framework.TestSuite.runTest(TestSuite.java:230) > at junit.framework.TestSuite.run(TestSuite.java:225) > at > org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) > at > org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) > Caused by: net.sf.swtbot.widgets.TimeoutException: Timeout after: 5000 ms.: > Could not find widget > at net.sf.swtbot.SWTBot.waitUntil(SWTBot.java:667) > at net.sf.swtbot.SWTBot.waitUntil(SWTBot.java:641) > at net.sf.swtbot.SWTBot.waitUntil(SWTBot.java:614) > at net.sf.swtbot.widgets.AbstractSWTBot.<init>(AbstractSWTBot.java:119) > ... 23 more > > > > > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ SWTBot-users mailing list SWTBot-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/swtbot-users http://swtbot.org/ - a functional testing tool for SWT/Eclipse