"Widget NOT Found"

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

"Widget NOT Found"

Postby ejain » Thu Sep 17, 2009 4:45 pm

I added a command (with a custom handler) to a view like so:

<menuContribution locationURI="toolbar:myView">
<command commandId="org.eclipse.ui.newWizard" style="push"/>
</menuContribution>
...
<handler class="TestHandler" commandId="org.eclipse.ui.newWizard">
<activeWhen>
<with variable="activePartId">
<equals value="myView"/>
</with>
</activeWhen>
</handler>

This works fine -- but the following test fails:

ui.click(new CTabItemLocator("My View"));
ui.click(new ContributedToolItemLocator("org.eclipse.ui.newWizard"));

Here's the stack trace:

com.windowtester.runtime.WidgetNotFoundException: Widget NOT Found:
ContributedToolItemLocator(org.eclipse.ui.newWizard)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:609)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:584)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:584)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:584)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:584)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:584)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:584)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:584)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:584)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:584)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:584)
at com.windowtester.internal.runtime.selector.ClickHelper.doFind(ClickHelper.java:192)
at com.windowtester.internal.runtime.selector.ClickHelper.click(ClickHelper.java:58)
at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:87)
at com.windowtester.runtime.swt.internal.UIContextSWT.click(UIContextSWT.java:297)
at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:80)
at com.windowtester.runtime.swt.internal.UIContextSWT.click(UIContextSWT.java:305)
at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:73)
at com.windowtester.runtime.swt.internal.UIContextSWT.click(UIContextSWT.java:288)
at SmokeTest.test(SmokeTest.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at com.windowtester.runtime.common.UITestCaseCommon.access$0(UITestCaseCommon.java:1)
at com.windowtester.runtime.common.UITestCaseCommon$2.run(UITestCaseCommon.java:136)
at com.windowtester.runtime.common.UITestCaseCommon$3.run(UITestCaseCommon.java:157)
at com.windowtester.internal.runtime.junit.core.SequenceRunner$1.run(SequenceRunner.java:46)
ejain
 
Posts: 10
Joined: Thu Sep 17, 2009 3:29 pm

Re: "Widget NOT Found"

Postby Phil Quitslund » Thu Sep 17, 2009 7:49 pm

Have you tried recording against this tool item? Is the code you posted faithful to a recording or did you write it by hand?
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

Re: "Widget NOT Found"

Postby ejain » Thu Sep 17, 2009 8:40 pm

Phil Quitslund wrote:Have you tried recording against this tool item? Is the code you posted faithful to a recording or did you write it by hand?


Should have mentioned that I wrote the code by hand. The recording tool generated:

Code: Select all
//WARNING: unsupported widget selection ignored - Widget Selection event: null
ejain
 
Posts: 10
Joined: Thu Sep 17, 2009 3:29 pm

Re: "Widget NOT Found"

Postby Phil Quitslund » Thu Sep 17, 2009 8:43 pm

Interesting! We'll have to take a look at this on our end. Is there anything unorthodox about your implementation? Can you help us put together a repro test case? Whatever hints you can give us will greatly speed up our investigation. Thanks!
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

Re: "Widget NOT Found"

Postby ejain » Fri Sep 18, 2009 3:22 pm

Phil Quitslund wrote:Interesting! We'll have to take a look at this on our end. Is there anything unorthodox about your implementation? Can you help us put together a repro test case? Whatever hints you can give us will greatly speed up our investigation. Thanks!


Don't think I'm doing anything unorthodox... For what it's worth, here is the relevant part of the output from new DebugHelper().printWidgets() just before attempting to use the ContributedToolItemLocator:

Code: Select all
Composite {}<HC|18051627>
  Composite {}<HC|16364317>
   ToolBar {}<HC|12130433>
    ToolItem {} No ActionContributionItem <HC|1297642>
    ToolItem {} No ActionContributionItem <HC|32652452>
   Composite {}<HC|33022579>
    Composite {}<HC|7037214>
     Table {}<HC|28643425>
      Menu {}<HC|18870712>
      ScrollBar {}<HC|4609608>
      ScrollBar {}<HC|30056312>
      TableColumn {A}<HC|28026670>
      TableColumn {B}<HC|7132795>
      TableColumn {C}<HC|24470798>
      TableColumn {D}<HC|4039132>
      TableColumn {E}<HC|5086911>
      TableColumn {F}<HC|32588568>
      TableColumn {G}<HC|7077235>
   [Composite {}<HC|20194674>]->(invisible)
    [CTabFolder {}<HC|30197448>]->(invisible)
     [ToolBar {}<HC|17740528>]->(invisible)
      [ToolItem {} No ActionContributionItem <HC|21103149>]->(invisible)
     [Label {}<HC|386451>]->(invisible)
     [Composite {}<HC|19086300>]->(invisible)
     [ViewForm {}<HC|3083783>]->(invisible)
      [Composite {}<HC|10284420>]->(invisible)
      [Composite {}<HC|11373565>]->(invisible)
      [Composite {}<HC|29477340>]->(invisible)
      [Composite {}<HC|28031905>]->(invisible)
      [Composite {}<HC|28007789>]->(invisible)
   CTabFolder {}<HC|8822415>
    CTabItem {My View}<HC|25340734>
    [ToolBar {}<HC|28880561>]->(invisible)
     [ToolItem {} No ActionContributionItem <HC|32841014>]->(invisible)
    [Label {}<HC|30730860>]->(invisible)
    [Composite {}<HC|23761097>]->(invisible)
    ViewForm {}<HC|21469060>
     [Composite {}<HC|22076627>]->(invisible)
     [Composite {}<HC|30516062>]->(invisible)
     [Composite {}<HC|3977697>]->(invisible)
     [Composite {}<HC|12728642>]->(invisible)
     [Composite {}<HC|20793223>]->(invisible)


"ToolItem {} No ActionContributionItem <HC|1297642>" looks like it might be the toolbar icon that should be clicked, see plugin.xml in a previous post to see how it was declared. What does "No ActionContributionItem" mean?
ejain
 
Posts: 10
Joined: Thu Sep 17, 2009 3:29 pm

Re: "Widget NOT Found"

Postby Phil Quitslund » Mon Sep 21, 2009 12:35 pm

It looks to me like we are not properly extracting the associated command id in (at least) this case. Could you send this as a bug report to our support team so we can schedule a fix?

wintest-support@instantiations.com

Thanks for the catch!
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest