Identifying Tree Items with RegEx

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

Identifying Tree Items with RegEx

Postby knarayan » Tue Oct 07, 2008 12:50 pm

Hello,

I had the following issue:
- I'm able to get what looks to be a valid "regular expression" to capture a tree element but upon execution of the test, I get a failure (WidgetNotFound exception). The regular expression looks to be correct to me and as you can see in the stack trace it is identifying the item I'm trying to get access to in the tree (Item in bold and given item list contains the item in Bold) - I'm not sure what the issue is as the node name contains a "/" so I have to use the //// to escape to give the exact string name of the tree item - any suggestions? :

Thanks!

Code: Select all
      ui.click(new TreeItemLocator("myMdaService/src\\\\/main\\\\/resources",
            new ViewLocator("org.eclipse.jdt.ui.PackageExplorer")));

com.windowtester.runtime.WidgetNotFoundException: com.windowtester.swt.WidgetNotFoundException: Item: [src/main/resources] not found in item list:
[JRE System Library [jre1.5.0_06]]
[Plug-in Dependencies]
[src/main/resources]
[src/main/java]
[src/generated/java]
[src/generated/resources]
[META-INF]
[src]
[build.properties]
[pom.xml]

at com.windowtester.swt.WidgetNotFoundException.getAdapter(WidgetNotFoundException.java:40)
at com.windowtester.internal.runtime.selector.ClickHelper.doClick(ClickHelper.java:181)
at com.windowtester.internal.runtime.selector.ClickHelper.click(ClickHelper.java:65)
at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:82)
at com.windowtester.runtime.swt.internal.UIContextSWT.click(UIContextSWT.java:293)
at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:75)
at com.windowtester.runtime.swt.internal.UIContextSWT.click(UIContextSWT.java:301)
at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:68)
at com.windowtester.runtime.swt.internal.UIContextSWT.click(UIContextSWT.java:284)
at com.intuit.dpt.modeleditor.uitests.NavigateToModeldiFile.testNavigateToModeldiFile(NavigateToModeldiFile.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at com.windowtester.runtime.common.UITestCaseCommon.access$001(UITestCaseCommon.java:25)
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)
Caused by: com.windowtester.swt.WidgetNotFoundException: Item: [src/main/resources] not found in item list:
[JRE System Library [jre1.5.0_06]]
[Plug-in Dependencies]
[src/main/resources]
[src/main/java]
[src/generated/java]
[src/generated/resources]
[META-INF]
[src]
[build.properties]
[pom.xml]

at com.windowtester.event.selector.swt.TreeItemSelector2.click(TreeItemSelector2.java:125)
at com.windowtester.runtime.swt.locator.TreeItemLocator.click(TreeItemLocator.java:210)
at com.windowtester.internal.runtime.selector.ClickHelper.doClick(ClickHelper.java:178)
... 18 more
knarayan
 
Posts: 7
Joined: Fri Sep 26, 2008 12:06 am

Re: Identifying Tree Items with RegEx

Postby Phil Quitslund » Fri Oct 10, 2008 2:20 pm

Hey all.

We're following up on this item via the associated bug report. We'll post the outcome here.
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

Re: Identifying Tree Items with RegEx

Postby knarayan » Mon Nov 03, 2008 11:50 am

Hi Phil,

Do you know of any updates on this issue? I also emailed the tech support alias as well.
Thanks!

- Kesavan
knarayan
 
Posts: 7
Joined: Fri Sep 26, 2008 12:06 am

Re: Identifying Tree Items with RegEx

Postby gnebling » Tue Nov 04, 2008 11:38 am

Here is the response via the support channel. Have you tried the suggestion below?

--
Hello Kesavan,

Sorry for the slow response. The team has been traveling for conferences (after busily preparing for a release).

Could you try the following?:

ui.click(new TreeItemLocator("myMdaService/src\\/main\\/resources"));

I think your original expression had too many escapes...

Let us know if that helps.

Thanks!

-- WT Support
gnebling
Moderator
 
Posts: 243
Joined: Tue Aug 22, 2006 7:49 am

Re: Identifying Tree Items with RegEx

Postby knarayan » Wed Nov 05, 2008 11:35 am

Thank you! I did get the Tech Support response and tried it out and it worked!
I think the confusion for me may have been the out of the box recorder output having the extra escape characters - is that still an issue: should the recorder output the correct regular expression for selecting that Tree Item.

Thanks!

- Kesavan
knarayan
 
Posts: 7
Joined: Fri Sep 26, 2008 12:06 am

Re: Identifying Tree Items with RegEx

Postby Phil Quitslund » Mon Nov 10, 2008 8:29 am

Emitting regular expressions (rather than literal paths) is something we've discussed but have not finalized. If you would like to see this happen, feel free to send a feature request to support.

Thanks for following up!
--
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