Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot with tycho - no context menu(Works under SWTBot launch config but not under maven.)
icon5.gif  SWTBot with tycho - no context menu [message #841587] Wed, 11 April 2012 10:01 Go to next message
Craig Foote is currently offline Craig Foote
Messages: 195
Registered: July 2009
Senior Member
I'm having trouble running an SWTBot TestCase under maven and tycho. The following code checks for a context menu item which works when running the test in my IDE but not when I run it using maven.
SWTBotTableItem item = view.bot().table().getTableItem("a");
item.select();
item.contextMenu("b");


In my pom I'm specifying tycho 0.14.1 and swtbot 2.0.0. It specifies the following configuration for the tycho-surefire-plugin:

<useUIHarness>true</useUIHarness>
<useUIThread>false</useUIThread>


I have my indirect dependencies listed as well. I've added debugging statements to the test method and verified the plugins that should be active are and that the current selection is correct. Just no context menu.

What could I be doing wrong?

Craig
Re: SWTBot with tycho - no context menu [message #1061115 is a reply to message #841587] Thu, 30 May 2013 02:21 Go to previous messageGo to next message
Peter Kullmann is currently offline Peter Kullmann
Messages: 199
Registered: July 2009
Senior Member
Craig, have you found a solution? I'm having the same problem. When I execute the tests with tycho there are no context menu entries visible to SWTBot. When I debug (surefire debugPort option) I can interact with the rcp under test and I can see that the context menu entries are visible - but for SWTBot the expression "part.pane.menuManager.items" returns 0 elements. Running the tests directly from the ide is working. BTW in my case I'm using eclipse 3.7.2 and not e4.

Regards,
Peter
Re: SWTBot with tycho - no context menu [message #1061142 is a reply to message #1061115] Thu, 30 May 2013 04:20 Go to previous message
Peter Kullmann is currently offline Peter Kullmann
Messages: 199
Registered: July 2009
Senior Member
I have found the solution for my own problem. I had the following code that worked in the ide and did not with tycho:

view.menu("Drucken").click();


Diving deeper into the SWTBot Code (2.0.5) one sees that if SWTBot doesn't find any menu entries (which it doesn't) it searches the command service for a command with this label. My menu entry was "Drucken" but the command was org.eclipse.ui.file.print - associated with the english text. As soon as I added org.eclipse.ui.nl_de to the test runtime everything worked well.

Peter
Previous Topic:No Classloader found for plug-in org.eclipse.jdt.junit4.runtime
Next Topic:Swtbot still depends on org.junit4?
Goto Forum:
  


Current Time: Fri Aug 01 06:03:02 EDT 2014

Powered by FUDForum. Page generated in 0.01550 seconds