Ketan Padegaonkar a écrit :
On 03-Oct-08, at 2:17 AM, Richard Adams wrote:

Hi, Just wanted to say thank you for this tool, its exactly what I've
been looking for for automated GUI testing of our RCP app.

Thanks, I'm glad that you liked SWTBot!

Just one query, I noticed for an Eclipse view, there is a menus()
method which returns View menus, but to get a context menu you need to
find it by its text. If this an Eclipse context meni I have no idea
what its called (it's actually the pop-up menu in the Common Navigator
View). Is there a way round this? I've been looking throughe the data
structures in the debugger but have not found any obvious reference to
a context menu object that I can find a name for.

I would like to have a functionality like:
   widget.contextMenus()
in order to verify if the plug-in embeds the contextual menus it is designed for, or for test debugging purposes.


There is a fundamental difference between the two menus. The view menus can be just looked up in the registry, which is what SWTBot does.

For the case of context menus, things get much more difficult. The context menu is computed lazily by eclipse, everytime. This is a performance optimization trick that eclipse applies. This is why you'll not find a object that holds references to anything in SWTBot, it would be technically possible to do this, but your tests would become dead slow. SWTBot applies the same trick, all things are computed lazily when a user requests that s/he needs something, context menus are one of them.

I see why I was not able to write the function I needed above :-(
Also debugging how a context menu is popped up is a mind boggling experience, you'd probably end up stepping through thousands of lines of code that perform look ups in a variety of locations to decide which menu items appear, where they appear, what's the text that appears, etc.

In most cases, you don't need to find the menu, you need a menu item (a menu is a container for menuitems). The menuitem text is what you should be passing in into the #contextMenu(menuItemText) api.

-- Ketan

--
Cordialement

Vincent MAHÉ

Ingénieur Plate-forme OpenEmbeDD - http://openembedd.org
IRISA-INRIA, Campus de Beaulieu, 35042 Rennes cedex, France
Tél: +33 (0) 2 99 84 71 00, Fax: +33 (0) 2 99 84 71 71

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
SWTBot-users mailing list
SWTBot-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse

Reply via email to