| || |
My turn to ask a question instead of answering.
I have a page with a list of items with a checkbox in front of each item. I need to check the state of the checkbox before and after various operations on the page (save, delete, etc).
The scenario is this: check the checkbox for item #3 on the list, save, read the database and verify that item #3 is still checked. Normally, pretty straight forward.
My problem is that after I check item #3, it moves to the top of the list (a user requirement). When I do the check, it is still checking the 3rd item on the list, but not the item I want to check (now in position #1).
Visually, here is what I am dealing with:
Item #1 - listitem 1 - checked
Item #2 - listitem 2 - unchecked
Item #3 - listitem 3 - unchecked
Item #4 - listitem 4 - checked
Item #1 - listitem 3 - checked
Item #2 - listitem 1 - checked
Item #3 - listitem 2 - unchecked
Item #4 - listitem 4 - checked.
When I run the "before" check, it is hitting listitem 3 checkbox.
When I run the "after" check, it is hitting listitem 2 checkbox (because it is in the position that listitem 3 used to be in).
I have tried property checks, field checks, text checks and content checks. I have messed with deleting various attributes (such as the position elements) with no luck.
The element ID also seems to be dynamic for this control, so I can't depend on that to pick up the correct checkbox in my check.
Does anyone have any suggestions?
[ 06-16-2006, 06:53 AM: Message edited by: Darrel Damon ]
Re: TestPartner checks
Store the list of items in an 2D-array. In the first Dimension store the list items actual text, and in the second dimension store the list items state (checked/unchecked).
Then after you do an action, such as checking on something, walk through your list and check that each item in the list can be found in the array and that the state is the same as before, except for the item you just acted upon, whose state will be the opposite.
If your program works such that as soon as you check something on, then you can assume that the first item you read from your list when you call the verification function should be in the array with the opposite state and the rest should be the same.
You didn't say what happens when you uncheck something (that is, does the order change again), so I don't know what this impact will be.
Anyway, this is an option to look into.
Current AUT running test scripts on TP 6.3 build 183, SQL 2000 DB.
Legacy AUT running on TP 5.6.0 Build 81 and TP 6.2 build 449 with SQL 2000 DB.
TP/IE Clients on VMWare ESX 4.1 server, AUT Servers on VMWare ESX 3.5 server.
Application Under Test (AUT):
Client/Server based, IE 7/8 interface with SQL 2005/2008 DB.
Automating with TP since August 2004.
Re: TestPartner checks
Thanks. This is exactly what I was looking for - a change in mindset. I was kind of stuck on using a check.
And yes, when you uncheck, it goes down in the list.