Jump to: navigation, search


< SWTBot
Revision as of 12:25, 4 January 2010 by KetanPadegaonkar.gmail.com (Talk | contribs) (added troubleshooting guide for ant-junit fragment version mismatch)

Update Sites
Mailing List
Open Bugzilla tickets
Open Gerrit reviews
Browse Source
Continuous Integration


SWTBot fails with"swtbottestapplication" could not be found in the registry

If you get an error like:

java.lang.RuntimeException: Application "org.eclipse.swtbot.eclipse.core.swtbottestapplication" could not be found in the registry.
The applications available are: some.long.list.of.application.ids

Then the most common cause is that the target platform does not have the "org.eclipse.swtbot.eclipse.core" plugin. If you're certain that you have this plugin, but the error persists. Try running with -consoleLog -debug options turned on while running the tests. This would most probably tell you about a missing dependency that causes the plugin to not load.

WidgetNotFoundException when stepping through SWTBot test in Eclipse debugger

If you set a debugger breakpoint in an SWTBot test and then step through it, you may see a WidgetNotFoundException from an SWTBot call that should easily succeed, like

SWTWorkbenchBot bot = new SWTWorkbenchBot();
bot.viewByTitle( "MyView" )

This is because when the debugger is in focus, your application is out of focus, which prevents SWTBot from finding its widgets. To fix this problem, just be sure to set any breakpoints after the SWTBot calls you're interested in, and don't expect to be able to step across subsequent SWTBot calls.

Headless Testing Troubleshooting

Exception in thread "WorkbenchTestable

Exception in thread "WorkbenchTestable" java.lang.ClassCastException:  org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter
    at  org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .run(EclipseTestRunner.java:331)
    at  org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .run(EclipseTestRunner.java:208)
    at  org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication .runTests(UITestApplication.java:115)
    at  org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
    at java.lang.Thread.run(Thread.java:595) 

The primary reason for this to happen is because you are using the incorrect version of an ant-junit fragment. If you are using swtbot, please ensure that you are not using the eclipse-test-framework's ant-junit fragment org.eclipse.ant.optional.junit_*.jar. Also ensure that you are using the right version of swtbot's ant-junit fragment that suits your junit version.

See Ant Setup and this thread for more up-to-date information on setting up dependencies.