Can't playback recorded test: LocationUnavailableException

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

Can't playback recorded test: LocationUnavailableException

Postby xonix » Thu Dec 02, 2010 6:46 am

Hi,

I'm trying to automate some UI program. While recording, it creates a line in a test:

Code: Select all
ui.click(new JTabbedPaneLocator("   Scan   "));


But when executing the generated test I'm getting:
Code: Select all
abbot.tester.LocationUnavailableException: The tab name (   Scan   ) was not found
   at abbot.tester.JTabbedPaneLocation.getPoint(JTabbedPaneLocation.java:84)
   at abbot.tester.JTabbedPaneTester.actionSelectTab(JTabbedPaneTester.java:30)
   at com.windowtester.internal.swing.UIDriverSwing.click(UIDriverSwing.java:129)
   at com.windowtester.internal.swing.DelayUIDriverSwing.click(DelayUIDriverSwing.java:57)
   at com.windowtester.runtime.swing.locator.JTabbedPaneLocator.doClick(JTabbedPaneLocator.java:85)
   at com.windowtester.runtime.swing.SwingWidgetLocator.click(SwingWidgetLocator.java:266)
   at com.windowtester.internal.runtime.selector.ClickHelper.doClick(ClickHelper.java:172)
   at com.windowtester.internal.runtime.selector.ClickHelper.click(ClickHelper.java:59)
   at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:140)
   at com.windowtester.internal.swing.UIContextSwing.click(UIContextSwing.java:57)
   at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:133)
   at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:126)
   at test.Test6.testTest6(Test6.java:41)
   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$0(UITestCaseCommon.java:1)
   at com.windowtester.runtime.common.UITestCaseCommon$2.run(UITestCaseCommon.java:130)
   at com.windowtester.runtime.common.UITestCaseCommon$3.run(UITestCaseCommon.java:151)
   at com.windowtester.internal.runtime.junit.core.SequenceRunner$1.run(SequenceRunner.java:40)

on this line.

The situation Is two times harder as I'm neither have sources for UI-client, as it's ~proprietary, nor, as I understand, the sources of Wintester Pro are publicly available (it possibly could help me sort out the bug with the help of debugging & manual rewrite of a test).

So my questions are:

1) Why this problem could happen? I'm afraid it could be not a single-case problem, as the UI under test is rather complex Swing-UI, and Window Tester I believe is a single available free tool with the ability to record/playback the test.

2) How could I solve such kind of problems, are there some recommendations on where to look/debug/hack to make it work? Is there a way, for example, to insert during execution of a test a line of java-code, that would print me the hierarchy of all controls, like, for instance, FEST tool can show the hierarchy of UI-controls: http://docs.codehaus.org/display/FEST/A ... t+be+found

Thank you,
Vladimir

UPD. I have tested this both with 6.0 and the Beta version of Window Tester, both give the error.
xonix
 
Posts: 4
Joined: Thu Dec 02, 2010 6:17 am

Re: Can't playback recorded test: LocationUnavailableExcepti

Postby keertip » Thu Dec 02, 2010 12:25 pm

You are getting this exception because the text in the tab does not match the string specified in the locator. Download the latest beta from

http://code.google.com/javadevtools/dow ... -beta.html

and run the test again. This time the error message should also give the text for the tabs. So you will be able to compare and change the string in the locator to match the tab text.

To get a hierarchy dump, bring up your application in eclipse and when it has focus, press CTRL + SHIFT + F1. This will print the swing component hierarchy to the console. This is very helpful to look up label/component text or to find nested components.
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am

Re: Can't playback recorded test: LocationUnavailableExcepti

Postby xonix » Fri Dec 03, 2010 3:44 am

Thank you, keertip

I'll try your advice.
xonix
 
Posts: 4
Joined: Thu Dec 02, 2010 6:17 am

Re: Can't playback recorded test: LocationUnavailableExcepti

Postby xonix » Fri Dec 03, 2010 6:57 am

Ok, I've tried your suggestions.

Now the error indeed shows some additional info, like:

Code: Select all
abbot.tester.LocationUnavailableException: Tab    Scan    not found. Found : (ORDER ENTRY)(ORDER QUEUE)


but:

1) Seems it doesn't recognize tabs, really present on screen
2) I can't visually find tabs with text like "ORDER ENTRY", "ORDER QUEUE" on screen.

Additionally, pressing STRL-SHIFT-F1 while recording not works for me =(, I'm still getting blank eclipse output console.

If it matters, I'm using Window Tester Beta on top of Eclipse 3.6 Helios.

Sincerely yours,
Vladimir
xonix
 
Posts: 4
Joined: Thu Dec 02, 2010 6:17 am

Re: Can't playback recorded test: LocationUnavailableExcepti

Postby keertip » Fri Dec 03, 2010 9:18 am

Hi Vladimir,

You would use Ctrl+Shift+F1 when you run the application by itself (Run As > Java Application), and not while recording.

At the time of test failure, is the tab " Scan " visible? Could you post a screen shot of your application at time of failure. Also the snippet of test code which leads to the click on the tabbed pane.
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am

Re: Can't playback recorded test: LocationUnavailableExcepti

Postby xonix » Sun Dec 05, 2010 6:34 pm

Hi, keertip

Here is a screen of the app:
tos1.PNG
tos1.PNG (41.45 KiB) Viewed 126 times

Here is my problem code (actually a piece of it):

Code: Select all
   /**
    * Main test method.
    */
   public void testTest6() throws Exception {
      System.out.println("Starting...");
      IUIContext ui = getUI();
      ui.wait(new WindowShowingCondition("Logon to thinkorswim"));
      ui.click(new JToggleButtonLocator("paperMoney"));
      ui.click(new LabeledTextLocator("User:"));
      ui.enterText("some_username");
      ui.click(new LabeledTextLocator("Password:"));
      ui.enterText("some_password");
      ui.click(new JButtonLocator("OK"));
      ui.wait(new WindowDisposedCondition("Logon to thinkorswim"));
      ui.wait(new WindowShowingCondition("Main @ paperMoney [build 1759]"));
      ui.wait(new WindowDisposedCondition("thinkorswim"));
      Thread.sleep(1000); // this is my attempt to wait till GUI loads, unsuccessful though
      ui.click(new JTabbedPaneLocator("   Scan   ")); // <--- UPS... (here is the problem...)
...


Also, I'm not understanding well, what do you mean by
you would use Ctrl+Shift+F1 when you run the application by itself (Run As > Java Application), and not while recording.


Problem is that application I'm trying to test I can't launch from eclipse, as it's not an eclipse-project application, but rather a stand-alone application, that I only have jar's of.
I can only bring up application UI
1) during recording phase
2) during running of recorded script (JUnit)

I've tried Strl-Shift-F1 during 1) and 2) but with no luck (no component dump to console).

One more note. I noticed, that during execution of a script (as well as recording) I'm having 100% CPU usage. Why could this happen?
The other problem (I suspect it appears upon switching to Beta) is that recording is started at "idle" mode, hense I have to turn it on manually. The problem with this is that line:

Code: Select all
ui.wait(new WindowShowingCondition("Logon to thinkorswim"));


not get recorded (have to add it manually), giving me "com.windowtester.runtime.WidgetNotFoundException: Component not found LabeledTextLocator("User:"): " at the very beginning of JUnit test.

Thanks for your help.

P.S. If it's interesting to you to try to reproduce the problem(s) by yourself, I can point you where to get a UI-client software.
xonix
 
Posts: 4
Joined: Thu Dec 02, 2010 6:17 am

Re: Can't playback recorded test: LocationUnavailableExcepti

Postby keertip » Mon Dec 06, 2010 8:45 am

Yes, do point us to where we can get the UI client software, would like to try this on our end.
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest

cron