Home » Archived » Test and Performance Tools Platform (TPTP) » [AGR] Invoking context-menu items inside an editor pane
| |
Re: [AGR] Invoking context-menu items inside an editor pane [message #87014 is a reply to message #86818] |
Mon, 13 November 2006 20:23 |
Chris McGee Messages: 99 Registered: July 2009 |
Member |
|
|
Hi Ali,
Thanks for the debugging help. I managed to run through a number of
debugging scenarios.
For the JDT Quick Outline menu item, I discovered the problem in
MacroObjectLocator.foundWidget(). Basically, the recorder records the
widget ID of the menu item as "{{Quick Outlineœtrl-O}}-{{1.0}}"
whereas the widget found in the actual menu is "{{Quick
Out&line}}-{{1.0}}." It looks like the recorder just needs to be
consistent with the MacroObjectLocator. I managed to hack the name in
the XML for the test case and it works perfectly.
I tested the same context menu capability in structured editor (an EMF
reflective editor with a tree-based content view) and I found that it
could not find a particular context menu item. The problem here is a
little more complicated. It seems that there is a difference in the way
that an editor is activated when be invoked from the AGR than when the
user manually opens up an editor. Here is a stack trace:
EXTLibraryEditor$7.requestActivation() line: 1106
EXTLibraryEditor$7(ViewerPane).handleEvent(Event) line: 211
EventTable.sendEvent(Event) line: 66
ViewForm(Widget).sendEvent(Event) line: 928
ViewForm(Widget).sendEvent(int, Event, boolean) line: 952
ViewForm(Widget).sendEvent(int) line: 933
Shell.setActiveControl(Control) line: 1199
ToolBar(Control).sendFocusEvent(int) line: 1984
ToolBar(Widget).wmSetFocus(int, int, int) line: 2145
ToolBar(Control).WM_SETFOCUS(int, int) line: 3860
ToolBar.WM_SETFOCUS(int, int) line: 1170
ToolBar(Control).windowProc(int, int, int, int) line: 3312
Display.windowProc(int, int, int, int) line: 4025
^ The above part of the trace does not get invoked when using the AGR
OS.SetFocus(int) line: not available [native method]
ToolBar(Control).forceFocus() line: 735
ToolBar(Control).setFocus() line: 2315
ToolBar(Composite).setFocus() line: 790
ViewForm(Composite).setFocus() line: 788
EXTLibraryEditor.setFocus() line: 1759
EditorPane(PartPane).setFocus() line: 309
EditorPane.setFocus() line: 117
WorkbenchPage$3.run() line: 600
SafeRunner.run(ISafeRunnable) line: 37
Platform.run(ISafeRunnable) line: 843
WorkbenchPage.activatePart(IWorkbenchPart) line: 595
WorkbenchPage.setActivePart(IWorkbenchPart) line: 3203
WorkbenchPage.activate(IWorkbenchPart) line: 588
WorkbenchPage.busyOpenEditorBatched(IEditorInput, String, boolean, int)
line: 2604
WorkbenchPage.busyOpenEditor(IEditorInput, String, boolean, int) line: 2528
WorkbenchPage.access$10(WorkbenchPage, IEditorInput, String, boolean,
int) line: 2520
WorkbenchPage$9.run() line: 2505
BusyIndicator.showWhile(Display, Runnable) line: 67
WorkbenchPage.openEditor(IEditorInput, String, boolean, int) line: 2500
WorkbenchPage.openEditor(IEditorInput, String, boolean) line: 2485
IDE.openEditor(IWorkbenchPage, IFile, boolean, boolean) line: 388
IDE.openEditor(IWorkbenchPage, IFile, boolean) line: 350
EditorUtility.openInEditor(IFile, boolean) line: 275
EditorUtility.openInEditor(Object, boolean) line: 139
OpenActionUtil.open(Object, boolean) line: 49
OpenAction.run(Object[]) line: 190
OpenAction.run(IStructuredSelection) line: 174
OpenAction(SelectionDispatchAction).dispatchRun(ISelection) line: 267
OpenAction(SelectionDispatchAction).run() line: 243
..
..
..
I can't seem to understand why the Java code behaves differently with
the AGR than with a regular user. Perhaps it has something to do with
SWT trying to send an OS event (OS.setFocus())? I even tried manually
inserting a wait state after opening up the editor to allow the display
to process any pending events.
If I can get some of these basic things working then I will definitely
be able to use the AGR to automate some UI tests.
Thanks,
Chris
Ali Mehregani wrote:
> You can attach a debugger to the process:
>
> 1) Check-out test/org.eclipse.tptp.test.auto.gui from the 4_2_1 branch
> 2) Open org.eclipse.tptp.test.auto.gui.internal.runner.AutoGUIExecOb jAdapter
> 3) Set DEBUG to true
> 4) Set your break points
> 5) Launch the test suite in standard mode
> 6) Create a debug launch configuration of type Remote Java Application
> 7) Change the port # to 8005 and click on debug
>
> Make sure that you keep your source in sync with
> <ECLIPSE-INSTANCE> /plugins/org.eclipse.tptp.test.auto.gui_4.2.0.v200608302257/ autogui.jar
> when you make any changes.
>
> I have also attached a test suite that uses key events to select an entry
> from the quick outline.
>
> Thanks,
> Ali Mehregani
>
> "Chris McGee" <cbmcgee@ca.ibm.com> wrote in message
> news:ej2i7c$mde$1@utils.eclipse.org...
>> Hello All,
>>
>> I seem to be having alot of problems with version 4.2.1 trying to get
>> the playback functionality to execute recorded context menu invocations
>> from inside an editor pane.
>>
>> All I'm doing, is trying to record the creation of a Java project, a
>> Java class and trying to open up a "Quick Outline" from the editor pane
>> using the context menu. The quick playback (in my development workbench)
>> will replay this context menu invocation with no problem. However, when
>> I actually run the Test runtime configuration, it fails at this point
>> with a CoreException thrown by MacroObjectLocator.locatePopupMenuItem().
>> The message is "Cannot locate menu item ..."
>>
>> I have tried to debug this problem myself but I cannot run the Test
>> configuration in Debug mode. Is there a way that I can bootstrap a PDE
>> runtime-workbench configuration to make it perform the test so that I
>> can debug it or somehow debug it another way?
>>
>> Thanks,
>> Chris
>
>
|
|
|
Re: [AGR] Invoking context-menu items inside an editor pane [message #87192 is a reply to message #87014] |
Tue, 14 November 2006 20:55 |
Chris McGee Messages: 99 Registered: July 2009 |
Member |
|
|
I managed to track down the latter case. It was because a modal dialog
was popping up in my eclipse. Removing the dialog fixed the problem.
Thanks,
Chris
Chris McGee wrote:
> Hi Ali,
>
> Thanks for the debugging help. I managed to run through a number of
> debugging scenarios.
>
> For the JDT Quick Outline menu item, I discovered the problem in
> MacroObjectLocator.foundWidget(). Basically, the recorder records the
> widget ID of the menu item as "{{Quick Outlineœtrl-O}}-{{1.0}}"
> whereas the widget found in the actual menu is "{{Quick
> Out&line}}-{{1.0}}." It looks like the recorder just needs to be
> consistent with the MacroObjectLocator. I managed to hack the name in
> the XML for the test case and it works perfectly.
>
> I tested the same context menu capability in structured editor (an EMF
> reflective editor with a tree-based content view) and I found that it
> could not find a particular context menu item. The problem here is a
> little more complicated. It seems that there is a difference in the way
> that an editor is activated when be invoked from the AGR than when the
> user manually opens up an editor. Here is a stack trace:
>
> EXTLibraryEditor$7.requestActivation() line: 1106
> EXTLibraryEditor$7(ViewerPane).handleEvent(Event) line: 211
> EventTable.sendEvent(Event) line: 66
> ViewForm(Widget).sendEvent(Event) line: 928
> ViewForm(Widget).sendEvent(int, Event, boolean) line: 952
> ViewForm(Widget).sendEvent(int) line: 933
> Shell.setActiveControl(Control) line: 1199
> ToolBar(Control).sendFocusEvent(int) line: 1984
> ToolBar(Widget).wmSetFocus(int, int, int) line: 2145
> ToolBar(Control).WM_SETFOCUS(int, int) line: 3860
> ToolBar.WM_SETFOCUS(int, int) line: 1170
> ToolBar(Control).windowProc(int, int, int, int) line: 3312
> Display.windowProc(int, int, int, int) line: 4025
> ^ The above part of the trace does not get invoked when using the AGR
> OS.SetFocus(int) line: not available [native method]
> ToolBar(Control).forceFocus() line: 735
> ToolBar(Control).setFocus() line: 2315
> ToolBar(Composite).setFocus() line: 790
> ViewForm(Composite).setFocus() line: 788
> EXTLibraryEditor.setFocus() line: 1759
> EditorPane(PartPane).setFocus() line: 309
> EditorPane.setFocus() line: 117
> WorkbenchPage$3.run() line: 600
> SafeRunner.run(ISafeRunnable) line: 37
> Platform.run(ISafeRunnable) line: 843
> WorkbenchPage.activatePart(IWorkbenchPart) line: 595
> WorkbenchPage.setActivePart(IWorkbenchPart) line: 3203
> WorkbenchPage.activate(IWorkbenchPart) line: 588
> WorkbenchPage.busyOpenEditorBatched(IEditorInput, String, boolean, int)
> line: 2604
> WorkbenchPage.busyOpenEditor(IEditorInput, String, boolean, int) line:
> 2528
> WorkbenchPage.access$10(WorkbenchPage, IEditorInput, String, boolean,
> int) line: 2520
> WorkbenchPage$9.run() line: 2505
> BusyIndicator.showWhile(Display, Runnable) line: 67
> WorkbenchPage.openEditor(IEditorInput, String, boolean, int) line: 2500
> WorkbenchPage.openEditor(IEditorInput, String, boolean) line: 2485
> IDE.openEditor(IWorkbenchPage, IFile, boolean, boolean) line: 388
> IDE.openEditor(IWorkbenchPage, IFile, boolean) line: 350
> EditorUtility.openInEditor(IFile, boolean) line: 275
> EditorUtility.openInEditor(Object, boolean) line: 139
> OpenActionUtil.open(Object, boolean) line: 49
> OpenAction.run(Object[]) line: 190
> OpenAction.run(IStructuredSelection) line: 174
> OpenAction(SelectionDispatchAction).dispatchRun(ISelection) line: 267
> OpenAction(SelectionDispatchAction).run() line: 243
> .
> .
> .
>
> I can't seem to understand why the Java code behaves differently with
> the AGR than with a regular user. Perhaps it has something to do with
> SWT trying to send an OS event (OS.setFocus())? I even tried manually
> inserting a wait state after opening up the editor to allow the display
> to process any pending events.
>
> If I can get some of these basic things working then I will definitely
> be able to use the AGR to automate some UI tests.
>
> Thanks,
> Chris
>
> Ali Mehregani wrote:
>> You can attach a debugger to the process:
>>
>> 1) Check-out test/org.eclipse.tptp.test.auto.gui from the 4_2_1 branch
>> 2) Open
>> org.eclipse.tptp.test.auto.gui.internal.runner.AutoGUIExecOb jAdapter
>> 3) Set DEBUG to true
>> 4) Set your break points
>> 5) Launch the test suite in standard mode
>> 6) Create a debug launch configuration of type Remote Java Application
>> 7) Change the port # to 8005 and click on debug
>>
>> Make sure that you keep your source in sync with
>> <ECLIPSE-INSTANCE> /plugins/org.eclipse.tptp.test.auto.gui_4.2.0.v200608302257/ autogui.jar
>> when you make any changes.
>>
>> I have also attached a test suite that uses key events to select an
>> entry from the quick outline.
>>
>> Thanks,
>> Ali Mehregani
>>
>> "Chris McGee" <cbmcgee@ca.ibm.com> wrote in message
>> news:ej2i7c$mde$1@utils.eclipse.org...
>>> Hello All,
>>>
>>> I seem to be having alot of problems with version 4.2.1 trying to get
>>> the playback functionality to execute recorded context menu invocations
>>> from inside an editor pane.
>>>
>>> All I'm doing, is trying to record the creation of a Java project, a
>>> Java class and trying to open up a "Quick Outline" from the editor pane
>>> using the context menu. The quick playback (in my development workbench)
>>> will replay this context menu invocation with no problem. However, when
>>> I actually run the Test runtime configuration, it fails at this point
>>> with a CoreException thrown by MacroObjectLocator.locatePopupMenuItem().
>>> The message is "Cannot locate menu item ..."
>>>
>>> I have tried to debug this problem myself but I cannot run the Test
>>> configuration in Debug mode. Is there a way that I can bootstrap a PDE
>>> runtime-workbench configuration to make it perform the test so that I
>>> can debug it or somehow debug it another way?
>>>
>>> Thanks,
>>> Chris
>>
>>
|
|
|
Re: [AGR] Invoking context-menu items inside an editor pane [message #87520 is a reply to message #87014] |
Wed, 15 November 2006 23:54 |
No real name Messages: 404 Registered: July 2009 |
Senior Member |
|
|
Hi Chris,
Please open a defect for the first case.
Thanks,
Ali Mehregani
"Chris McGee" <cbmcgee@ca.ibm.com> wrote in message
news:ejak88$st1$1@utils.eclipse.org...
> Hi Ali,
>
> Thanks for the debugging help. I managed to run through a number of
> debugging scenarios.
>
> For the JDT Quick Outline menu item, I discovered the problem in
> MacroObjectLocator.foundWidget(). Basically, the recorder records the
> widget ID of the menu item as "{{Quick Outlineœtrl-O}}-{{1.0}}"
> whereas the widget found in the actual menu is "{{Quick
> Out&line}}-{{1.0}}." It looks like the recorder just needs to be
> consistent with the MacroObjectLocator. I managed to hack the name in the
> XML for the test case and it works perfectly.
>
> I tested the same context menu capability in structured editor (an EMF
> reflective editor with a tree-based content view) and I found that it
> could not find a particular context menu item. The problem here is a
> little more complicated. It seems that there is a difference in the way
> that an editor is activated when be invoked from the AGR than when the
> user manually opens up an editor. Here is a stack trace:
>
> EXTLibraryEditor$7.requestActivation() line: 1106
> EXTLibraryEditor$7(ViewerPane).handleEvent(Event) line: 211
> EventTable.sendEvent(Event) line: 66 ViewForm(Widget).sendEvent(Event)
> line: 928 ViewForm(Widget).sendEvent(int, Event, boolean) line: 952
> ViewForm(Widget).sendEvent(int) line: 933 Shell.setActiveControl(Control)
> line: 1199 ToolBar(Control).sendFocusEvent(int) line: 1984
> ToolBar(Widget).wmSetFocus(int, int, int) line: 2145
> ToolBar(Control).WM_SETFOCUS(int, int) line: 3860 ToolBar.WM_SETFOCUS(int,
> int) line: 1170 ToolBar(Control).windowProc(int, int, int, int) line: 3312
> Display.windowProc(int, int, int, int) line: 4025
> ^ The above part of the trace does not get invoked when using the AGR
> OS.SetFocus(int) line: not available [native method]
> ToolBar(Control).forceFocus() line: 735 ToolBar(Control).setFocus() line:
> 2315 ToolBar(Composite).setFocus() line: 790
> ViewForm(Composite).setFocus() line: 788 EXTLibraryEditor.setFocus() line:
> 1759 EditorPane(PartPane).setFocus() line: 309 EditorPane.setFocus() line:
> 117 WorkbenchPage$3.run() line: 600 SafeRunner.run(ISafeRunnable) line: 37
> Platform.run(ISafeRunnable) line: 843
> WorkbenchPage.activatePart(IWorkbenchPart) line: 595
> WorkbenchPage.setActivePart(IWorkbenchPart) line: 3203
> WorkbenchPage.activate(IWorkbenchPart) line: 588
> WorkbenchPage.busyOpenEditorBatched(IEditorInput, String, boolean, int)
> line: 2604 WorkbenchPage.busyOpenEditor(IEditorInput, String, boolean,
> int) line: 2528 WorkbenchPage.access$10(WorkbenchPage, IEditorInput,
> String, boolean, int) line: 2520 WorkbenchPage$9.run() line: 2505
> BusyIndicator.showWhile(Display, Runnable) line: 67
> WorkbenchPage.openEditor(IEditorInput, String, boolean, int) line: 2500
> WorkbenchPage.openEditor(IEditorInput, String, boolean) line: 2485
> IDE.openEditor(IWorkbenchPage, IFile, boolean, boolean) line: 388
> IDE.openEditor(IWorkbenchPage, IFile, boolean) line: 350
> EditorUtility.openInEditor(IFile, boolean) line: 275
> EditorUtility.openInEditor(Object, boolean) line: 139
> OpenActionUtil.open(Object, boolean) line: 49 OpenAction.run(Object[])
> line: 190 OpenAction.run(IStructuredSelection) line: 174
> OpenAction(SelectionDispatchAction).dispatchRun(ISelection) line: 267
> OpenAction(SelectionDispatchAction).run() line: 243
> .
> .
> .
>
> I can't seem to understand why the Java code behaves differently with the
> AGR than with a regular user. Perhaps it has something to do with SWT
> trying to send an OS event (OS.setFocus())? I even tried manually
> inserting a wait state after opening up the editor to allow the display to
> process any pending events.
>
> If I can get some of these basic things working then I will definitely be
> able to use the AGR to automate some UI tests.
>
> Thanks,
> Chris
>
> Ali Mehregani wrote:
>> You can attach a debugger to the process:
>>
>> 1) Check-out test/org.eclipse.tptp.test.auto.gui from the 4_2_1 branch
>> 2) Open
>> org.eclipse.tptp.test.auto.gui.internal.runner.AutoGUIExecOb jAdapter
>> 3) Set DEBUG to true
>> 4) Set your break points
>> 5) Launch the test suite in standard mode
>> 6) Create a debug launch configuration of type Remote Java Application
>> 7) Change the port # to 8005 and click on debug
>>
>> Make sure that you keep your source in sync with
>> <ECLIPSE-INSTANCE> /plugins/org.eclipse.tptp.test.auto.gui_4.2.0.v200608302257/ autogui.jar
>> when you make any changes.
>>
>> I have also attached a test suite that uses key events to select an entry
>> from the quick outline.
>>
>> Thanks,
>> Ali Mehregani
>>
>> "Chris McGee" <cbmcgee@ca.ibm.com> wrote in message
>> news:ej2i7c$mde$1@utils.eclipse.org...
>>> Hello All,
>>>
>>> I seem to be having alot of problems with version 4.2.1 trying to get
>>> the playback functionality to execute recorded context menu invocations
>>> from inside an editor pane.
>>>
>>> All I'm doing, is trying to record the creation of a Java project, a
>>> Java class and trying to open up a "Quick Outline" from the editor pane
>>> using the context menu. The quick playback (in my development workbench)
>>> will replay this context menu invocation with no problem. However, when
>>> I actually run the Test runtime configuration, it fails at this point
>>> with a CoreException thrown by MacroObjectLocator.locatePopupMenuItem().
>>> The message is "Cannot locate menu item ..."
>>>
>>> I have tried to debug this problem myself but I cannot run the Test
>>> configuration in Debug mode. Is there a way that I can bootstrap a PDE
>>> runtime-workbench configuration to make it perform the test so that I
>>> can debug it or somehow debug it another way?
>>>
>>> Thanks,
>>> Chris
>>
|
|
|
Goto Forum:
Current Time: Sat Dec 21 16:14:01 GMT 2024
Powered by FUDForum. Page generated in 0.03753 seconds
|