Label Text on SWTWidgetLocator not recognized by WT

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

Label Text on SWTWidgetLocator not recognized by WT

Postby shikhahanda » Thu Sep 09, 2010 2:28 pm

In Eclipse if you go to view the Problems View (Windows>Show View>Other>Problems), the number of errors , warnings and items are displayed. I want to capture the text of the Label (0 errors, 2 warnings, 0 others). When I record the test case, the following code is generated.

public void testshikha1() throws Exception {
IUIContext ui = getUI();
ui.click(new SWTWidgetLocator(Label.class, "0 errors, 2 warnings, 0 others"));
ui.click(new CTabItemLocator("Properties"));
ui.click(new MenuItemLocator("File/Exit"));

When I run this test case an exception "Widget Not Found Exception" is displayed. Please refer to the below error stack:

com.windowtester.runtime.WidgetNotFoundException: Widget NOT Found:
SWTWidgetLocator(org.eclipse.swt.widgets.Label, 0 errors, 2 warnings, 0 others)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:616)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:591)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:591)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:591)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:591)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:591)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:591)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:591)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:591)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:591)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:591)
at com.windowtester.internal.runtime.selector.ClickHelper.doFind(ClickHelper.java:193)
at com.windowtester.internal.runtime.selector.ClickHelper.click(ClickHelper.java:58)
at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:146)
at com.windowtester.runtime.swt.internal.UIContextSWT.click(UIContextSWT.java:338)
at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:139)
at com.windowtester.runtime.swt.internal.UIContextSWT.click(UIContextSWT.java:346)
at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:132)
at com.windowtester.runtime.swt.internal.UIContextSWT.click(UIContextSWT.java:308)
at com.vmware.vide.test.testsuite.devkit.cimpdk.shikha1.testshikha1(shikha1.java:29)
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:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
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)

Can someone help me with the solution.
Thanks in advance..
Shikha
shikhahanda
 
Posts: 3
Joined: Thu Aug 19, 2010 3:24 am

Re: Label Text on SWTWidgetLocator not recognized by WT

Postby keertip » Mon Sep 20, 2010 9:03 pm

Take a look at the code at

http://code.google.com/p/wt-commons/sou ... blems.java

It demonstrates a way to access the info in Problems View.
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