Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 14:40 Go to next message
Antoine Omnès is currently offline Antoine OmnèsFriend
Messages: 11
Registered: September 2017
Junior Member
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 186 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 16:58 Go to previous messageGo to next message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 53
Registered: July 2009
Member
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 07:53 Go to previous messageGo to next message
Antoine Omnès is currently offline Antoine OmnèsFriend
Messages: 11
Registered: September 2017
Junior Member
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 08:41]

Report message to a 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 10:57 Go to previous message
Antoine Omnès is currently offline Antoine OmnèsFriend
Messages: 11
Registered: September 2017
Junior Member
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: Thu Sep 20 23:49:27 GMT 2018

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

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

Back to the top