Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » GEF editor returns "The graphical viewer is null"(GEF editor)
GEF editor returns "The graphical viewer is null" [message #783132] Wed, 25 January 2012 05:56 Go to next message
Ramesh D is currently offline Ramesh D
Messages: 17
Registered: January 2012
Junior Member
Hi,

I am a QA engineer with experience on other UI based functional testing tool. Just now found SWTBot to be very useful in creating my tests for my application which is eclipse based. I was able to identify most of the widgets but i am unable to identify the GEF editor i get an error message saying "The graphical viewer is null".

when i try to eclipse spy on my object i get the following info on the editor.

//Shell/-1//Composite/4//Composite/0//Composite/10//Composite/2//Composite/0//InfaCTabFolder/0//Composite/0//Canvas/0

which seems to be a canvas.

i get the error when i am executing the below statement on the editor which has the name as "demo".


bot.gefEditor("demo").close();

Can any please help me with this?

below is the stack trace. also attached the snapshot of the editor.


org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException: The graphical viewer is null.
at org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefViewer.<init>(SWTBotGefViewer.java:79)
at org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor.<init>(SWTBotGefEditor.java:65)
at org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot.createEditor(SWTGefBot.java:70)
at org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot.gefEditor(SWTGefBot.java:60)
at org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot.gefEditor(SWTGefBot.java:42)
at Myfirst.testcloseWelcomeWizard(Myfirst.java:142)
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:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at org.eclipse.swtbot.swt.finder.SWTBotTestCase.runBare(SWTBotTestCase.java:228)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main(RemotePluginTestRunner.java:64)
at org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(UITestApplication.java:117)
at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(WorkbenchTestable.java:71)
at java.lang.Thread.run(Thread.java:662)

[Updated on: Wed, 25 January 2012 05:58]

Report message to a moderator

Re: GEF editor returns &quot;The graphical viewer is null&quot; [message #783345 is a reply to message #783132] Wed, 25 January 2012 14:59 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael Istria
Messages: 755
Registered: July 2009
Location: Grenoble, France
Senior Member
bot.getEditor expects as argument the label of the editor like you can
read on the tab of the editor.
In general, a screenshot is very helpful when it comes to guessing why
SWTBot cannot find something.


--
http://mickaelistria.wordpress.com
http://twitter.com/#!/mickaelistria
http://www.petalslink.com
Re: GEF editor returns &quot;The graphical viewer is null&quot; [message #784160 is a reply to message #783345] Fri, 27 January 2012 06:01 Go to previous messageGo to next message
Ramesh D is currently offline Ramesh D
Messages: 17
Registered: January 2012
Junior Member
Hi Mickael,

Thanks for the help. But i still give the same name as on the editor tab o even using the SWTBotGefEditor bot.gefEditor(bot.activeEditor().getTitle()); does lead to the same error.

Ramesh
Re: GEF editor returns &quot;The graphical viewer is null&quot; [message #793566 is a reply to message #784160] Wed, 08 February 2012 09:45 Go to previous message
Ramesh D is currently offline Ramesh D
Messages: 17
Registered: January 2012
Junior Member
I have attached the snapshot.

Thanks
Ramesh
  • Attachment: Untitled.jpg
    (Size: 516.02KB, Downloaded 98 times)
Previous Topic:Failed to generate keyboard layout
Next Topic:[SWTBotEditor] Can not doubleclick on cell element
Goto Forum:
  


Current Time: Fri Sep 19 19:56:10 GMT 2014

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

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