This is a migrated thread and some comments may be shown as answers.

Validating Tree view in Silver light using telerik Data driven test

1 Answer 35 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sandeep
Top achievements
Rank 1
Sandeep asked on 10 May 2011, 08:26 AM
Using data driven test, child item for tree view are getting populated as per telerik Data table values.  We are trying to validate the tree control (silverlight application) in which child node are added dynamically through the application from local table which is added before,  we want to test whether child node are added correctly or not to the tree. we are trying to validate with C# Customized code. We have reference for the parent node(ParentLeftmousebuttondowntreeviewitem) for that newly added to child. Parent node(ParentLeftmousebuttondowntreeviewitem) object type is TreeViewItem which is silverlight application object (refer attached file - ParentNodeInfo.jpg). But child node object is mentioned as FrameworkElement object. For parent node (ParentLeftmousebuttondowntreeviewitem) property Children had collection of IList<FrameworkElement> (refer attached file - ParentNodeInfo.jpg). Is there any sample code to help me out.
Following bolew both API (GetChildren() and Children) is not returning any child nodes  from parent node. Pages.SMART.SilverlightApp.OrganizationStructureLeftmousebuttondowntreeviewitem.GetChildren() and
Pages.SMART.SilverlightApp.OrganizationStructureLeftmousebuttondowntreeviewitem.Children

1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 16 May 2011, 08:41 PM
Hello Sandeep,

You should be using the .Items property of the TreeViewItem. It returns a list of all nods under that current node. You can then use the .Text property to obtain all the text underneath each node. Here's an example:

TreeViewItem rootTvItem = Pages.TreeViewBoundTo.FrameContent.SilverlightApp.DataGridTreeviewitem;
foreach (TreeViewItem tvItem in rootTvItem.Items)
{
    Log.WriteLine(tvItem.Text);
}

Kind regards,
Cody
the Telerik team
Do you think you know all the new features coming out in Test Studio R1 2011? Think again - we have some surprises and will share them with you in the What's New in Test Studio R1 2011 Webinar on May 12th.
Register Today!
Tags
General Discussions
Asked by
Sandeep
Top achievements
Rank 1
Answers by
Cody
Telerik team
Share this question
or