Swing: problem with JMenuItemLocator

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

Swing: problem with JMenuItemLocator

Postby jimmi1977 » Thu Jun 04, 2009 9:49 am

I am currently evaluating WindowTester for Swing. I have used SWT version before with success. Now I need swing testing.

I record a simple test, this is what is recorded:

ui.click(new JMenuItemLocator("File/New/New Project"));

Here's how the UI looks:
Image

When I run the test, I get this:

com.windowtester.runtime.WidgetNotFoundException: Component not found JMenuItemLocator("New Project"):
class=class com.conceptwave.servicedesigner.main.NewMainFrame
name=frame0
title=ConceptWave Design Studio
at com.windowtester.internal.swing.UIContextSwing.find(UIContextSwing.java:219)
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.internal.swing.UIContextSwing.click(UIContextSwing.java:64)
at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:80)
at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:73)
at com.conceptwave.servicedesigner.tests.WTTest.testWT(WTTest.java:59)
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:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
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)

I tried this (first two work, third one fails):
ui.click(new JMenuLocator("File"));
ui.click(new JMenuLocator("New"));
ui.click(new JMenuLocator("New Project"));

I tried keyboard shortcuts, that didn't work either.

Any ideas?

Thanks!
jimmi1977
 
Posts: 5
Joined: Thu Jun 04, 2009 8:54 am

Re: Swing: problem with JMenuItemLocator

Postby jimmi1977 » Thu Jun 04, 2009 10:46 am

Found a root cause: JMenuLocator and JMenuItemLocator cannot handle menu items with images. Really strange...

Please consider this a bug report
jimmi1977
 
Posts: 5
Joined: Thu Jun 04, 2009 8:54 am

Re: Swing: problem with JMenuItemLocator

Postby jimmi1977 » Thu Jun 04, 2009 1:00 pm

jimmi1977 wrote:Found a root cause: JMenuLocator and JMenuItemLocator cannot handle menu items with images. Really strange...

Please consider this a bug report


Not really. It stopped working again. Seems that it just plainly works sometimes (2 out of 20 times maybe). This is really strange...
jimmi1977
 
Posts: 5
Joined: Thu Jun 04, 2009 8:54 am

Re: Swing: problem with JMenuItemLocator

Postby Phil Quitslund » Thu Jun 04, 2009 7:40 pm

Could you send this in to support so we can open a case and track it there?:

wintest-support@instantiations.com

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

Re: Swing: problem with JMenuItemLocator

Postby jimmi1977 » Fri Jun 05, 2009 5:27 am

Sent.
jimmi1977
 
Posts: 5
Joined: Thu Jun 04, 2009 8:54 am

Re: Swing: problem with JMenuItemLocator

Postby Phil Quitslund » Mon Jun 08, 2009 8:21 am

Thank you!
--
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