Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot UI Test(SWTBot UI Test Error)
SWTBot UI Test [message #826824] Thu, 22 March 2012 14:52 Go to next message
Kollin Krause is currently offline Kollin KrauseFriend
Messages: 18
Registered: March 2012
Junior Member
Hello!
I use SWTBot to test my UI.


In my test i start the UI and close the welcome window:

SWTBotView eclipseView = bot.activeView();
if (eclipseView != null && view.getTitle().equals("Welcome")) {
eclipseView.close();
}


After that i set the perspective:

bot.perspectiveByLabel(perspective).activate();


And after that i will do this:

bot.menu("File").menu("New").menu("Java Project").click();

I will open a new java project and at this point i get an error like this:


Error in --> AbstractSWTBot.class:

public AbstractSWTBot(T w, SelfDescribing description) throws
WidgetNotFoundException {
if (w == null)
throw new WidgetNotFoundException("The widget was null.");

...
}



Error Trace:

org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException: The widget was null.
at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot.<init>(AbstractSWTBot.java:97)
at org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu.<init>(SWTBotMenu.java:42)
at org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu.menu(SWTBotMenu.java:96)
at com.dfe.esom.freezer.ui.graphic.UITest.createNewJavaProject(UITest.java:62)



Any ideas or hints what may be the cause of this?
Thanks!

[Updated on: Fri, 23 March 2012 13:33]

Report message to a moderator

Re: SWTBot UI Test [message #828158 is a reply to message #826824] Sat, 24 March 2012 09:37 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 03/22/2012 03:52 PM, Kollin Krause wrote:
> Hello!
> I use SWTBot to test my UI.
>
>
> In my test i start the UI and close the welcome window:
>
> SWTBotView eclipseView = bot.activeView();
> if (eclipseView != null && view.getTitle().equals("Welcome")) {
> eclipseView.close();
> }
>
>
> After that i set the perspective:
>
> bot.perspectiveByLabel(perspective).activate();
>
>
> And after that i will do this:
>
> bot.menu("File").menu("New").menu("Java Project").click();
>
> I will open a new java project and at this point i get an error like this:
>
>
> Error in --> AbstractSWTBot.class:
>
> public AbstractSWTBot(T w, SelfDescribing description) throws
> WidgetNotFoundException {
> if (w == null)
> throw new WidgetNotFoundException("The widget was null.");
>
> ..
> }
>
>
>
> Error Trace:
>
> org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException: The
> widget was null.
> at
> org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot.<init>(AbstractSWTBot.java:97)
>
> at
> org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu.<init>(SWTBotMenu.java:42)
> at
> org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu.menu(SWTBotMenu.java:96)
> at
> com.dfe.esom.freezer.ui.graphic.UITest.createNewJavaProject(UITest.java:62)
>

Hi

which perspective are you switching to? Because "Java Project" is
available right after "New" only in the Java perspective... you may
want to try this code which should work with all the perspectives

bot.menu("File").menu("New").menu("Project...").click();

SWTBotShell shell = bot.shell("New Project");
shell.activate();
bot.tree().select("Java Project");
bot.button("Next >").click();

hope this helps
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: SWTBot UI Test [message #829377 is a reply to message #828158] Mon, 26 March 2012 07:59 Go to previous messageGo to next message
Kollin Krause is currently offline Kollin KrauseFriend
Messages: 18
Registered: March 2012
Junior Member
Thank you very much ... it works, but after the code:

bot.button("Next >").click();


I create my new Project File with:

bot.button("Finish").click();


The project is created, but after a short while i get this error:


!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:601)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:567)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:490)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:478)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:458)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:473)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:260)
at org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:63)
at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:327)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:229)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2245)
at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1145)
at org.eclipse.ui.internal.WorkbenchPage$20.run(WorkbenchPage.java:3921)


Any ideas or hints what may be the cause of this?
Thanks!
Re: SWTBot UI Test [message #831144 is a reply to message #829377] Wed, 28 March 2012 14:22 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
You should increase the permgen space in the launch of your swtbot test...

I usually do that by setting these arguments in the launch

-Xms40m -Xmx384m -XX:MaxPermSize=256m

hope this helps :)
cheers
Lorenzo

On 03/26/2012 09:59 AM, Kollin Krause wrote:
> Thank you very much ... it works, but after the code:
>
> bot.button("Next >").click();
>
> I create my new Project File with:
>
> bot.button("Finish").click();
>
> The project is created, but after a short while i get this error:
>
>
> !MESSAGE Unhandled event loop exception
> !STACK 0
> java.lang.OutOfMemoryError: PermGen space
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClassCond(Unknown Source)
> at java.lang.ClassLoader.defineClass(Unknown Source)
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:601)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:567)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:490)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:478)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:458)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
>
> at
> org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
>
> at
> org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
>
> at
> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:473)
>
> at
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
>
> at
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
>
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at
> org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
>
> at
> org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
>
> at
> org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
>
> at
> org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
>
> at
> org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
>
> at
> org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:260)
>
> at
> org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:63)
>
> at
> org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:327)
>
> at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:229)
> at
> org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
>
> at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2245)
> at
> org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1145)
> at org.eclipse.ui.internal.WorkbenchPage$20.run(WorkbenchPage.java:3921)
>
>
> Any ideas or hints what may be the cause of this?
> Thanks!
>


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: SWTBot UI Test [message #831723 is a reply to message #831144] Thu, 29 March 2012 08:57 Go to previous message
Kollin Krause is currently offline Kollin KrauseFriend
Messages: 18
Registered: March 2012
Junior Member
Hello Lorenzo!
Thank you for your reply. It works! Wink

Kollin

[Updated on: Thu, 29 March 2012 08:57]

Report message to a moderator

Previous Topic:find a context menu (which has a keyboard shortcut)
Next Topic:How about enhancing SWTBot to support more Nebula widgets?
Goto Forum:
  


Current Time: Tue Apr 23 06:39:02 GMT 2024

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

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

Back to the top