Skip to main content



      Home
Home » Eclipse Projects » SWTBot » How to link a Part from an RCP App to SWTBot?
How to link a Part from an RCP App to SWTBot? [message #1773104] Thu, 21 September 2017 10:40 Go to next message
Eclipse UserFriend
Hi,

I am starting to use SWTBot to test my application Eclipse RCP v4.

This is my code, to get a part via an id and activate it.
protected static void openPart(final String id) {
    Display.getDefault().syncExec(new Runnable() {

        public void run() {
            EPartService partService = E4Workbench.getServiceContext().getActiveLeaf().get(EPartService.class);
            MPart part = partService.findPart(id);
            partService.activate(part);
        }
    });
}


This is my tests. And it doesn't work...

@Test
public void test1() {
    openPart("testmaker.part.gauche");
    bot.tree().getTreeItem("hju / PQT").expand();
}

@Test
public void test2() {
    openPart("testmaker.part.stepRightSide");
    bot.button("Add Comment").click();
}


I don't know how to link my `private static SWTBot bot;` with my RCP Part.

I have already tried with bot.viewby...(name/id/etc).show();, it doesn't work.

This is my RCP application :

index.php/fa/30787/0/

Does anyone can help me to use an RCP app with SWTBot ?
It is perhaps obvious for you, but it would be very useful for me.
Thank you.
  • Attachment: RCP.png
    (Size: 16.29KB, Downloaded 670 times)
Re: How to link a Part from an RCP App to SWTBot? [message #1773110 is a reply to message #1773104] Thu, 21 September 2017 12:58 Go to previous messageGo to next message
Eclipse UserFriend
Hi Antoine,

I'm not too familiar with testing E4 RCP applications, but you might want to look at SWTBot's own E4 unit tests, for example:

http://git.eclipse.org/c/swtbot/org.eclipse.swtbot.git/tree/org.eclipse.swtbot.e4.finder.test/src/org/eclipse/swtbot/e4/finder/test/parts/tests/SWTBotViewTest.java

Make sure that you are using the SWTWorkbenchBot from the org.eclipse.swtbot.e4.finder plug-in.

Patrick
Re: How to link a Part from an RCP App to SWTBot? [message #1773142 is a reply to message #1773110] Fri, 22 September 2017 03:53 Go to previous messageGo to next message
Eclipse UserFriend
Hi Patrick,

Thank you very much, I think it is what I am looking for!

What is the way to install org.eclipse.swtbot.e4.finder ? I am using the tool from Eclipse with this link: http://download.eclipse.org/technology/swtbot/releases/latest
and after the installation org.eclipse.swtbot.e4 is in the folder eclipse/plugins

But I can't use it in a project with import...

Thanks.
Antoine

[Updated on: Fri, 22 September 2017 04:41] by Moderator

Re: How to link a Part from an RCP App to SWTBot? [message #1773156 is a reply to message #1773142] Fri, 22 September 2017 06:57 Go to previous message
Eclipse UserFriend
In adding org.eclipse.swtbot.e4.finder in the dependencies, it works.
Previous Topic:Testing FXCanvas with SWTBot
Next Topic:How to modify Tree/table?
Goto Forum:
  


Current Time: Tue May 20 09:25:27 EDT 2025

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

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

Back to the top