Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Test and Performance Tools Platform (TPTP) » Cannot locate menu item
Cannot locate menu item [message #116716] Tue, 30 October 2007 06:54 Go to next message
Pushparaj is currently offline PushparajFriend
Messages: 62
Registered: July 2009
Member
Hi All,

I’ve recoded an AGR test case where a PreferenceDialog is spawned from a
top level menu and new pages are added from the right-click menus(my
dialog has pop-up menus in the right hand side). Now when I run the AGR
test case it opens the PreferenceDialog after that it throws error
messages.

Any idea why this is happening?

org.eclipse.core.runtime.CoreException
Line 15: Cannot locate menu item: {{New}}-{{1.0}}
org.eclipse.core.runtime.CoreException: Line 15: Cannot locate menu item:
{{New}}-{{1.0}}
at
org.eclipse.tptp.test.auto.gui.internal.AutoGUIUtil.throwCor eException(AutoGUIUtil.java:616)
at
org.eclipse.tptp.test.auto.gui.internal.AutoGUIUtil.throwCor eException(AutoGUIUtil.java:608)
at
org.eclipse.tptp.test.auto.gui.internal.macro.MacroObjectLoc ator.locatePopupMenuItem(MacroObjectLocator.java:432)
at
org.eclipse.tptp.test.auto.gui.internal.macro.MacroObjectLoc ator.locateCommandTarget(MacroObjectLocator.java:92)
at
org.eclipse.tptp.test.auto.gui.internal.commands.BooleanSele ctionCommand.playback(BooleanSelectionCommand.java:258)
at
org.eclipse.tptp.test.auto.gui.internal.commands.MacroComman dShell$4.run(MacroCommandShell.java:1160)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:123)
Re: Cannot locate menu item [message #117318 is a reply to message #116716] Tue, 06 November 2007 12:49 Go to previous messageGo to next message
Paul Slauenwhite is currently offline Paul SlauenwhiteFriend
Messages: 975
Registered: July 2009
Senior Member
Hi Pushparaj,
The AGR cannot locate the correct menu item. For more
information on the solution, see the Widget Resolving Mechanism section in
the AGR documentation:

http://www.eclipse.org/tptp/test/documents/userguides/Intro- Auto-GUI-4-4-0.html#2.4

Paul
"Pushparaj" <pushparaj_94@yahoo.com> wrote in message
news:83d569cd68d488b9a5ad00065ef96fc2$1@www.eclipse.org...
> Hi All,
>
> I
Re: Cannot locate menu item [message #121700 is a reply to message #117318] Fri, 01 February 2008 09:44 Go to previous messageGo to next message
Pushparaj is currently offline PushparajFriend
Messages: 62
Registered: July 2009
Member
Hi Paul,

As per the description I has added the following entry in the widgetReg.xml

<class name = "org.eclipse.swt.widgets.Text" matchThreshold = "1.0">
<method name = "getData" weight = "1.0">
<argument value = "menu.new"/>
</method>
</class>
<class name = "org.eclipse.swt.widgets.Text" matchThreshold = "1.0">
<method name = "getData" weight = "1.0">
<argument value = "menu.delete"/>
</method>
</class>

I has changed my pop-up menu's code in pereference dialog like ,

public void handleEvent(Event event) {

Menu menu = new Menu(_dialog.getShell(), SWT.POP_UP);

MenuItem newItem = new MenuItem(menu, SWT.PUSH);
newItem.setText("New");
newItem.setData("menu.new", "MyNew");
newItem.addSelectionListener(new PopUpListener());

MenuItem deleteItem = new MenuItem(menu, SWT.PUSH);
deleteItem.setText("Delete");
deleteItem.setData("menu.delete", "MyDelete");
deleteItem.addSelectionListener(new PopUpListener());

menu.setLocation(event.x, event.y);
menu.setVisible(true);
}

then I has recorded same use case. But my AGR script is looks like
same. As per my understanding widget id should be save like this,
<command descriptive="New" type="select"
resolverId="org.eclipse.tptp.test.auto.gui.nontrivial"
contextId="popup/shell/org.eclipse.swt.widgets.Tree#1"
widgetId="{{MyNew}}-{{1.0}}"/>

But AGR script is saved like this,
<command descriptive="New" type="select"
resolverId="org.eclipse.tptp.test.auto.gui.nontrivial"
contextId="popup/shell/org.eclipse.swt.widgets.Tree#1"
widgetId="{{New}}-{{1.0}}"/>

I am not able continue my work because of this issue. Please help me ro
resolve this.


Thanks,
Pushparaj.
Re: Cannot locate menu item [message #121713 is a reply to message #121700] Fri, 01 February 2008 11:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: any.swc.rwth-aachen.de

I think the class name should be org.eclipse.swt.widgets.MenuItem instead of
org.eclipse.swt.widgets.Text, if you want to resolve MenuItems.

Regards
Alexander


"Pushparaj" <pushparaj_94@yahoo.com> schrieb im Newsbeitrag
news:d36084abb2a5330e20bd3bf6bffef72c$1@www.eclipse.org...
> Hi Paul,
>
> As per the description I has added the following entry in the
> widgetReg.xml
>
> <class name = "org.eclipse.swt.widgets.Text" matchThreshold = "1.0">
> <method name = "getData" weight = "1.0">
> <argument value = "menu.new"/>
> </method>
> </class>
> <class name = "org.eclipse.swt.widgets.Text" matchThreshold = "1.0">
> <method name = "getData" weight = "1.0">
> <argument value = "menu.delete"/>
> </method>
> </class>
>
> I has changed my pop-up menu's code in pereference dialog like ,
>
> public void handleEvent(Event event) {
> Menu menu = new Menu(_dialog.getShell(), SWT.POP_UP);
> MenuItem newItem = new MenuItem(menu, SWT.PUSH);
> newItem.setText("New");
> newItem.setData("menu.new", "MyNew");
> newItem.addSelectionListener(new PopUpListener());
> MenuItem deleteItem = new MenuItem(menu, SWT.PUSH);
> deleteItem.setText("Delete");
> deleteItem.setData("menu.delete", "MyDelete");
> deleteItem.addSelectionListener(new PopUpListener());
> menu.setLocation(event.x, event.y);
> menu.setVisible(true);
> }
> then I has recorded same use case. But my AGR script is looks like
> same. As per my understanding widget id should be save like this,
> <command descriptive="New" type="select"
> resolverId="org.eclipse.tptp.test.auto.gui.nontrivial"
> contextId="popup/shell/org.eclipse.swt.widgets.Tree#1"
> widgetId="{{MyNew}}-{{1.0}}"/>
>
> But AGR script is saved like this,
> <command descriptive="New" type="select"
> resolverId="org.eclipse.tptp.test.auto.gui.nontrivial"
> contextId="popup/shell/org.eclipse.swt.widgets.Tree#1"
> widgetId="{{New}}-{{1.0}}"/>
>
> I am not able continue my work because of this issue. Please help me ro
> resolve this.
>
>
> Thanks,
> Pushparaj.
>
>
Re: Cannot locate menu item [message #121725 is a reply to message #121713] Fri, 01 February 2008 11:58 Go to previous messageGo to next message
Pushparaj is currently offline PushparajFriend
Messages: 62
Registered: July 2009
Member
Hi Alaxendar,
I tried with MenuItem, But i am getting same error.

Thanks,
Pushparaj
Re: Cannot locate menu item [message #121810 is a reply to message #121700] Sat, 02 February 2008 08:51 Go to previous messageGo to next message
Jimmy Jin is currently offline Jimmy JinFriend
Messages: 32
Registered: July 2009
Member
Hi, Pushparaj,

I think the way you modify the widgetReg.xml is incorrect first.

As I understand, the "value" attribute of <argument> element should be
the key of the getData()/setData() method.

So if your menuItem is set as:

newItem.setData("menu.key", "MyNew");
deleteItem.setData("menu.key", "MyDelete");

Then you can have the following lines in widgetReg.xml, for using the
"menu.key" key's value to identify the menu item.
<class name = "org.eclipse.swt.widgets.MenuItem" matchThreshold = "1.0">
<method name = "getData" weight = "1.0">
<argument value = "menu.key"/>
</method>
</class>

Then your recorded script will looks like

<command descriptive="New" type="select"
resolverId="org.eclipse.tptp.test.auto.gui.nontrivial"
contextId="popup/shell/org.eclipse.swt.widgets.Tree#1"
widgetId="MyNew"/>

Your current recorded script are actually not resolved using the
widgetReg.xml file. It is resolved by
org.eclipse.tptp.test.auto.gui.internal.resolvers.NonTrivial WidgetResolver.
Only the
org.eclipse.tptp.test.auto.gui.internal.resolvers.AdaptiveWi dgetResolver
uses the widgetReg.xml file.

Regards,
Jimmy Jin

Pushparaj wrote:
> Hi Paul,
>
> As per the description I has added the following entry in the widgetReg.xml
>
> <class name = "org.eclipse.swt.widgets.Text" matchThreshold = "1.0">
> <method name = "getData" weight = "1.0">
> <argument value = "menu.new"/>
> </method>
> </class>
> <class name = "org.eclipse.swt.widgets.Text" matchThreshold = "1.0">
> <method name = "getData" weight = "1.0">
> <argument value = "menu.delete"/>
> </method>
> </class>
>
> I has changed my pop-up menu's code in pereference dialog like ,
>
> public void handleEvent(Event event) {
>
> Menu menu = new Menu(_dialog.getShell(), SWT.POP_UP);
>
> MenuItem newItem = new MenuItem(menu, SWT.PUSH);
> newItem.setText("New");
> newItem.setData("menu.new", "MyNew");
> newItem.addSelectionListener(new PopUpListener());
> MenuItem deleteItem = new MenuItem(menu, SWT.PUSH);
> deleteItem.setText("Delete");
> deleteItem.setData("menu.delete", "MyDelete");
> deleteItem.addSelectionListener(new PopUpListener());
> menu.setLocation(event.x, event.y);
> menu.setVisible(true);
> }
> then I has recorded same use case. But my AGR script is looks like
> same. As per my understanding widget id should be save like this,
> <command descriptive="New" type="select"
> resolverId="org.eclipse.tptp.test.auto.gui.nontrivial"
> contextId="popup/shell/org.eclipse.swt.widgets.Tree#1"
> widgetId="{{MyNew}}-{{1.0}}"/>
>
> But AGR script is saved like this,
> <command descriptive="New" type="select"
> resolverId="org.eclipse.tptp.test.auto.gui.nontrivial"
> contextId="popup/shell/org.eclipse.swt.widgets.Tree#1"
> widgetId="{{New}}-{{1.0}}"/>
>
> I am not able continue my work because of this issue. Please help me ro
> resolve this.
>
>
> Thanks,
> Pushparaj.
>
>
Re: Cannot locate menu item [message #121849 is a reply to message #121810] Sun, 03 February 2008 12:59 Go to previous messageGo to next message
Pushparaj is currently offline PushparajFriend
Messages: 62
Registered: July 2009
Member
Hi Jimmy Jin,

As per your reply I has changed my widgetReg.xml. Now the recorded script
is proper. but while running the script i am getting the same error.


Thanks,
Pushparaj.
Re: Cannot locate menu item [message #121866 is a reply to message #121849] Sun, 03 February 2008 14:47 Go to previous messageGo to next message
Jimmy Jin is currently offline Jimmy JinFriend
Messages: 32
Registered: July 2009
Member
Hi, Pushparaj,

I looked at the code you included in your message again, and I found
something strange in your code. You have the menu created in a
handleEvent method. What is this listener listening for? The mouse
right-click? If it is the case, I think, even you can record the script,
you still cannot playback it.

The reason is that the way MacroObjectLocator uses for finding out the
popup menu item is by using the Control.getMenu() method on all the
controls on one Shell to get all the popup menus and then try to find
out if any of them matches the desired one. Since your menu is
dynamically created, maybe when the command is running, the menu hasn't
been created, so it cannot be found. I'm not sure whether it can work,
if you simulate a mouse click to make the menu created before select the
menu. Or, if possible, you can change the mechanism to have the menu
created statically and set to certain Control on the dialog.

Maybe if you provide the script you recorded after the latest change to
the widgetReg.xml, I can provide some more advise.

Jimmy Jin

Pushparaj wrote:
> Hi Jimmy Jin,
>
> As per your reply I has changed my widgetReg.xml. Now the recorded
> script is proper. but while running the script i am getting the same error.
>
>
> Thanks,
> Pushparaj.
Re: Cannot locate menu item [message #122143 is a reply to message #121866] Tue, 05 February 2008 10:38 Go to previous messageGo to next message
Pushparaj is currently offline PushparajFriend
Messages: 62
Registered: July 2009
Member
Hi Jimmy Jin,
Yes. I am creating menus in mouse right-click.
As per my requirement i should create menu itemes at runtime(dynamically).
So Pls give me some other solutions

<macro version="1.0">
<shell descriptive="OpenClovis IDE - MyTestSuite1 - Eclipse SDK"
id="org.eclipse.ui.internal.WorkbenchWindow" return-code="-1">
<command descriptive="TestModel" type="item-select"
resolverId="org.eclipse.tptp.test.auto.gui.adaptive"
contextId="view/com.clovis.cw.workspace.clovisWorkspaceView "
widgetId="{{/}}-{{1.0}}">
<item path="{{/TestModel}}-{{1.0}}"
resolverId="org.eclipse.tptp.test.auto.gui.adaptive"/>
</command>
<command type="focus"
contextId="view/com.clovis.cw.workspace.clovisWorkspaceView "
widgetId="org.eclipse.swt.widgets.Composite#1"/>
<command descriptive="AMF Configuration... Ctrl+Shift+F" type="select"
resolverId="org.eclipse.tptp.test.auto.gui.nontrivial" contextId="menus"
widgetId="{{Clovis-AMF Configuration...&amp;#x9;Ctrl+Shift+F}}-{{1.0}}"/>
<shell descriptive="TestModel - AMF Configuration"
id="com.clovis.cw.editor.ca.dialog.NodeProfileDialog" return-code="0">
<command descriptive="AMS Configuration" type="item-expand"
contextId="shell" widgetId="org.eclipse.swt.widgets.Tree#1" value="true">
<item path="{{AMFNode}}-{{1.0}}"
resolverId="org.eclipse.tptp.test.auto.gui.adaptive"/>
</command>
<command descriptive="Service Group List" type="item-select"
contextId="shell" widgetId="org.eclipse.swt.widgets.Tree#1">
<item path="{{Service Group List}}-{{1.0}}"
resolverId="org.eclipse.tptp.test.auto.gui.adaptive"/>
</command>
<command descriptive="New" type="select"
resolverId="org.eclipse.tptp.test.auto.gui.adaptive"
contextId="popup/shell/org.eclipse.swt.widgets.Tree#1"
widgetId="{{AMFNew}}-{{1.0}}"/>
<command descriptive="SAFComponent0SG" type="choice-select"
contextId="shell" widgetId="org.eclipse.swt.custom.CCombo#1"
choiceId="item#0"/>
<command descriptive="OK" type="select"
resolverId="org.eclipse.tptp.test.auto.gui.adaptive" contextId="shell"
widgetId="{{0}}-{{1.0}}"/>
</shell>
</shell>
</macro>

Thanks,
Pushparaj
Re: Cannot locate menu item [message #122585 is a reply to message #122143] Sun, 10 February 2008 11:40 Go to previous message
Jimmy Jin is currently offline Jimmy JinFriend
Messages: 32
Registered: July 2009
Member
Hello, Pushparaj,

After reading the script you recorded, I think I know your scenario more
.. Here are some suggestions from me, which I think I will take if I do
it by myself.

1. When dynamically creating the popup menu, it MUST be set to certain
Control, such as the Tree. It is for making sure that when playing back,
AGR can use the getMenu method to locate the menu. So I may add the
following lines into the handleEvent method.

Tree myTree = (Tree) event.widget;
myTree.setMenu(menu);

2. The mouse right-click event must be simulated and notify all the
listeners of the event on the Tree, so that the menu gets created. There
are 2 ways, in my mind, can achieve this.
a. Add a Verification Point before the popup menu selection command,
and in the Verification Point, find out the Tree and send it a proper
event with notifyListener method (or just call the handleEvent method
directly).
b. Add a Position Based command before popup menu selection command.

I'm not sure if this can help, since I haven't encountered this kind of
case so far.

Regards,
Jimmy Jin

Pushparaj wrote:
> Hi Jimmy Jin,
> Yes. I am creating menus in mouse right-click.
> As per my requirement i should create menu itemes at
> runtime(dynamically). So Pls give me some other solutions
>
> <macro version="1.0">
> <shell descriptive="OpenClovis IDE - MyTestSuite1 - Eclipse SDK"
> id="org.eclipse.ui.internal.WorkbenchWindow" return-code="-1">
> <command descriptive="TestModel" type="item-select"
> resolverId="org.eclipse.tptp.test.auto.gui.adaptive"
> contextId="view/com.clovis.cw.workspace.clovisWorkspaceView "
> widgetId="{{/}}-{{1.0}}">
> <item path="{{/TestModel}}-{{1.0}}"
> resolverId="org.eclipse.tptp.test.auto.gui.adaptive"/>
> </command>
> <command type="focus"
> contextId="view/com.clovis.cw.workspace.clovisWorkspaceView "
> widgetId="org.eclipse.swt.widgets.Composite#1"/>
> <command descriptive="AMF Configuration... Ctrl+Shift+F"
> type="select" resolverId="org.eclipse.tptp.test.auto.gui.nontrivial"
> contextId="menus" widgetId="{{Clovis-AMF
> Configuration...&amp;#x9;Ctrl+Shift+F}}-{{1.0}}"/>
> <shell descriptive="TestModel - AMF Configuration"
> id="com.clovis.cw.editor.ca.dialog.NodeProfileDialog" return-code="0">
> <command descriptive="AMS Configuration" type="item-expand"
> contextId="shell" widgetId="org.eclipse.swt.widgets.Tree#1" value="true">
> <item path="{{AMFNode}}-{{1.0}}"
> resolverId="org.eclipse.tptp.test.auto.gui.adaptive"/>
> </command>
> <command descriptive="Service Group List" type="item-select"
> contextId="shell" widgetId="org.eclipse.swt.widgets.Tree#1">
> <item path="{{Service Group List}}-{{1.0}}"
> resolverId="org.eclipse.tptp.test.auto.gui.adaptive"/>
> </command>
> <command descriptive="New" type="select"
> resolverId="org.eclipse.tptp.test.auto.gui.adaptive"
> contextId="popup/shell/org.eclipse.swt.widgets.Tree#1"
> widgetId="{{AMFNew}}-{{1.0}}"/>
> <command descriptive="SAFComponent0SG" type="choice-select"
> contextId="shell" widgetId="org.eclipse.swt.custom.CCombo#1"
> choiceId="item#0"/>
> <command descriptive="OK" type="select"
> resolverId="org.eclipse.tptp.test.auto.gui.adaptive" contextId="shell"
> widgetId="{{0}}-{{1.0}}"/>
> </shell>
> </shell>
> </macro>
>
> Thanks,
> Pushparaj
>
Previous Topic:Unable to profile pre 1.5
Next Topic:AGR Benefits
Goto Forum:
  


Current Time: Tue Mar 19 05:30:58 GMT 2024

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

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

Back to the top