Exact item match with TableItemLocator?

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

Exact item match with TableItemLocator?

Postby Steffen8708 » Fri Nov 21, 2008 6:01 am

Hi,

it's me again. The TableItemLocator seems to look only for a text of a table item in one column. If not, how can i specify the texts of each column separately? The problem is that if i want to test for visibility of a table item with text "some" in column 1 and "letters" in column 2 using

TableItemLocator("some", new ColumnLocator(1)) and
TableItemLocator("letters", new ColumnLocator(2))

the test will also pass if two table items exist with the same text but just one column filled per item (e.g. item 1 has "some" in column 1 and item 2 has "letters" in column 2). This is not the desired behaviour. Any ideas to manage this?

Steffen
Steffen8708
 
Posts: 29
Joined: Tue Nov 04, 2008 7:11 am

Re: Exact item match with TableItemLocator?

Postby Steffen8708 » Fri Nov 21, 2008 6:21 am

I think deriving the TableItemLocator and overriding the matches method to match only table items with all columns compared to reference strings works fine. But a locator from Window Tester would be better.
Steffen8708
 
Posts: 29
Joined: Tue Nov 04, 2008 7:11 am

Re: Exact item match with TableItemLocator?

Postby Phil Quitslund » Tue Nov 25, 2008 2:35 pm

Thanks for posting this.

Another alternative would be to play with the new TableCellLocator:

http://downloads.instantiations.com/Win ... cator.html

Note that composition is a bit different with this locator. For example here is how you would specify a view component:

Code: Select all
new TableCellLocator("myRow", "myColumn).in(new VIewLocator("my.view");

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

Re: Exact item match with TableItemLocator?

Postby Steffen8708 » Thu Nov 27, 2008 2:24 am

I think this helps if I want to test for table items in a given row and their columns. Surely, I will need this for the future. But my "solution" mentioned in the first reply is sufficient for my problem.

Thanks for the reference to TableCellLocator,
Steffen
Steffen8708
 
Posts: 29
Joined: Tue Nov 04, 2008 7:11 am

Re: Exact item match with TableItemLocator?

Postby Phil Quitslund » Thu Dec 04, 2008 7:15 pm

Great. Let us know how it goes. We're always happy to help.
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

Re: Exact item match with TableItemLocator?

Postby hyshyshys » Fri Apr 17, 2009 6:09 am

How could I test that a table is empty?

I know that I could get a widget reference from the tableLocator and then use the SWT api but I would prefer to use the WindowTester api...

Thanks
hyshyshys
 
Posts: 37
Joined: Thu Jul 03, 2008 12:27 pm

Re: Exact item match with TableItemLocator?

Postby Phil Quitslund » Mon Apr 20, 2009 10:12 am

Maybe something like this?:

Code: Select all
IWidgetLocator items[] = ui.findAll(new TableItemLocator(".*"));
assertEquals(0, items.length);
--
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