SWTbot and XMind [message #558730] |
Tue, 14 September 2010 04:47  |
Eclipse User |
|
|
|
Originally posted by: wycieruch.gmail.com
Hi,
It's my first post on this newsgroup so hello everybody :)
I have an issue with SWTbot, which I was going to use to test my
application based on Xmind. And Xmind is GEF based mind map editor.
I installed SWTbot for GEF plugin and I wrote my first test class.
However when I want to get access to the gef editor I get un error. The
label of the editor is ok and everything is like in tutorial. I'm sure
that editor was found by SWTbot but in the end I got null pointer
exception. Can somebody tell me what is wrong?
My eclipse version: 3.5
My SWTbot version: 2.0
Thanks for any help
Marek.
package com.nglogic.xmindlook.testing.tests;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEdito r;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(SWTBotJunit4ClassRunner.class)
public class MyFirstTest {
private static SWTWorkbenchBot bot;
private static SWTGefBot gefBot;
@BeforeClass
public static void beforeClass() throws Exception {
bot = new SWTWorkbenchBot();
gefBot = new SWTGefBot();
}
@Test
public void canCreateANewJavaProject() throws Exception {
//the line below gives un error
SWTBotGefEditor editor = gefBot.gefEditor("Workbook 1");
}
@AfterClass
public static void sleep() {
bot.sleep(2000);
}
}
|
|
|
|
|
Re: SWTbot and XMind [message #559289 is a reply to message #559175] |
Thu, 16 September 2010 05:35   |
Eclipse User |
|
|
|
Hi Marek,
I assume this line throws the Exception : "final Control control = graphicalViewer.getControl();"
It means that in your case "editor.getAdapter(GraphicalViewer.class)" returns null, which is not expected.
Could you confirm this, or at least give me the version of SWTBot you use ?
Thanks,
Mariot
Marek Adamek a écrit :
> Hi Mariot,
>
> The trace is in the attached text file.
>
> Regards,
> Marek
>
> W dniu 2010-09-14 11:02, Mariot Chauvin pisze:
>> Hi Marek,
>>
>> Can you give us the stacktrace ?
>>
>> Thanks,
>>
>> Mariot
>>
>>
>> Marek Adamek a écrit :
>>> Hi,
>>> It's my first post on this newsgroup so hello everybody :)
>>>
>>> I have an issue with SWTbot, which I was going to use to test my
>>> application based on Xmind. And Xmind is GEF based mind map editor.
>>>
>>> I installed SWTbot for GEF plugin and I wrote my first test class.
>>> However when I want to get access to the gef editor I get un error. The
>>> label of the editor is ok and everything is like in tutorial. I'm sure
>>> that editor was found by SWTbot but in the end I got null pointer
>>> exception. Can somebody tell me what is wrong?
>>>
>>> My eclipse version: 3.5
>>> My SWTbot version: 2.0
>>>
>>> Thanks for any help
>>> Marek.
>>>
>>> package com.nglogic.xmindlook.testing.tests;
>>>
>>> import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
>>> import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
>>> import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEdito r;
>>> import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
>>> import org.junit.AfterClass;
>>> import org.junit.BeforeClass;
>>> import org.junit.Test;
>>> import org.junit.runner.RunWith;
>>>
>>> @RunWith(SWTBotJunit4ClassRunner.class)
>>> public class MyFirstTest {
>>>
>>> private static SWTWorkbenchBot bot;
>>> private static SWTGefBot gefBot;
>>> @BeforeClass
>>> public static void beforeClass() throws Exception {
>>> bot = new SWTWorkbenchBot();
>>> gefBot = new SWTGefBot();
>>> }
>>>
>>>
>>> @Test
>>> public void canCreateANewJavaProject() throws Exception {
>>> //the line below gives un error
>>> SWTBotGefEditor editor = gefBot.gefEditor("Workbook 1");
>>> }
>>>
>>>
>>> @AfterClass
>>> public static void sleep() {
>>> bot.sleep(2000);
>>> }
>>>
>>> }
>
|
|
|
Re: SWTbot and XMind [message #630183 is a reply to message #559289] |
Thu, 30 September 2010 18:41  |
Eclipse User |
|
|
|
Originally posted by: wycieruch.gmail.com
Hi Mariot.
I am so sorry I made you waiting for the response so long. I should have
done it earlier - sorry once again.
You were right. The method editor.getAdapter(GraphicalViewer.class)
returns null. I will let the XMind team know about this issue. Thanks a lot!
Sincerely,
Marek.
W dniu 2010-09-16 11:35, Mariot Chauvin pisze:
> Hi Marek,
>
> I assume this line throws the Exception : "final Control control = graphicalViewer.getControl();"
> It means that in your case "editor.getAdapter(GraphicalViewer.class)" returns null, which is not expected.
> Could you confirm this, or at least give me the version of SWTBot you use ?
>
> Thanks,
>
> Mariot
>
>
> Marek Adamek a écrit :
>> Hi Mariot,
>>
>> The trace is in the attached text file.
>>
>> Regards,
>> Marek
>>
>> W dniu 2010-09-14 11:02, Mariot Chauvin pisze:
>>> Hi Marek,
>>>
>>> Can you give us the stacktrace ?
>>>
>>> Thanks,
>>>
>>> Mariot
>>>
>>>
>>> Marek Adamek a écrit :
>>>> Hi,
>>>> It's my first post on this newsgroup so hello everybody :)
>>>>
>>>> I have an issue with SWTbot, which I was going to use to test my
>>>> application based on Xmind. And Xmind is GEF based mind map editor.
>>>>
>>>> I installed SWTbot for GEF plugin and I wrote my first test class.
>>>> However when I want to get access to the gef editor I get un error. The
>>>> label of the editor is ok and everything is like in tutorial. I'm sure
>>>> that editor was found by SWTbot but in the end I got null pointer
>>>> exception. Can somebody tell me what is wrong?
>>>>
>>>> My eclipse version: 3.5
>>>> My SWTbot version: 2.0
>>>>
>>>> Thanks for any help
>>>> Marek.
>>>>
>>>> package com.nglogic.xmindlook.testing.tests;
>>>>
>>>> import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
>>>> import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
>>>> import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEdito r;
>>>> import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
>>>> import org.junit.AfterClass;
>>>> import org.junit.BeforeClass;
>>>> import org.junit.Test;
>>>> import org.junit.runner.RunWith;
>>>>
>>>> @RunWith(SWTBotJunit4ClassRunner.class)
>>>> public class MyFirstTest {
>>>>
>>>> private static SWTWorkbenchBot bot;
>>>> private static SWTGefBot gefBot;
>>>> @BeforeClass
>>>> public static void beforeClass() throws Exception {
>>>> bot = new SWTWorkbenchBot();
>>>> gefBot = new SWTGefBot();
>>>> }
>>>>
>>>>
>>>> @Test
>>>> public void canCreateANewJavaProject() throws Exception {
>>>> //the line below gives un error
>>>> SWTBotGefEditor editor = gefBot.gefEditor("Workbook 1");
>>>> }
>>>>
>>>>
>>>> @AfterClass
>>>> public static void sleep() {
>>>> bot.sleep(2000);
>>>> }
>>>>
>>>> }
>>
|
|
|
Powered by
FUDForum. Page generated in 0.05325 seconds