On
Mon, 26 Dec 2005 05:04:31 +0000 (GMT)
chaya shetty <[EMAIL PROTECTED]> wrote:
chaya shetty <[EMAIL PROTECTED]> wrote:
Hi,
The application under test has got a tree structure. I want to write a test case which invovles navigating through the tree structure and verifying whether the correct screen is displayed when the corresponding link is clicked. I am able to navigate through the tree structure by using the link index.I am retrieving the innertext of the link and then verifying whether that text is present on the other frame. The code that I am using link_index = 1 while(ie.frame(:index,tree_frame_index).link(:index,link_index).exists?)
link_text = ie.frame(:index,tree_frame_index).link(:index,link_index).innerText
ie.frame(:index,tree_frame_index).link(:index,link_index).click
if $ie.frame(:index,text_frame_index).contains_text(link_text)
puts "Test passed"
else
puts "Test failed"
end
link_index = link_index + 1
end
Here the text of the child nodes are same for all the parent nodes. How do I know whether the text displayed of the child node belongs to the corresponding parent node?
How would you know this if you /weren't/ using WATIR? That is, how would you determine correctness if you were clicking on the links manually and observing with own your eyes and brain?
Is there way by which we can find out the parent nodes and child nodes of a tree structure in watir?
If I understand your question correctly, you should be able to walk the application's pages as you're doing above (using Watir) and build a tree structure based on hashes (and hashes of hashes) or stacks (using Ruby). But so far as I know, there's no guarantee anywhere in Web-land that a given page is the parent of another. Several pages higher in a hierarchy can be pointing to the same page lower in it; thus a page can have many "parents". Pages can be related as parents and children simultaneously. That is, in math-speak, Web sites can be viewed as graphs, but there's nothing (other than someone's mental organizing model) that says that they are trees.
Moveover, neither Ruby nor Watir knows anything about what constitutes correctness. Correctness will have to come from the heuristics that you program into your tests. That's why (for example), I would change "Test passed" and "Test failed" above to "child page contains text found in link on parent page" -- I would at least make that translation in my head.
I know this might not get you what you want, but I hope it clarifies things.
---Michael B.
DevelopSense: Software Testing in Plain English
http://www.developsense.com
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
