Completed
Last Updated: 02 Jun 2015 07:40 by Gary
ADMIN
Ralitsa
Created on: 15 Apr 2015 11:55
Category: UI Framework
Type: Bug Report
0
FIX. RadTreeView - expose the Checked and CheckedState properties to be selected through Coded UI Test Builder
To reproduce: 
1. Drag and drop RadTreeView on the form. Set the CheckBoxes property to true. 
2. Add a Coded UI Test. Start the Coded UI Test Builder and select one of nodes. 
3. In the UI Control Map is not exposed the Checked/CheckState properties and can not add a assertion

Workaround: 
Add method which read the tree view xml file and check the state;  

Assert.AreEqual(true, IsNodeChecked(uINode6TreeItem.Name, this.UIForm1Window.UIRadTreeView1Tree.TreeViewXml));
bool IsNodeChecked(string nodeName, string treeXMl)
{
    XmlDocument treeXMLDocument = new XmlDocument();
    treeXMLDocument.LoadXml(treeXMl);
    
    foreach (XmlNode xNode in treeXMLDocument.ChildNodes)
    {                                
        if (IsChecked(nodeName, xNode.ChildNodes))
        {
            return true; 
        }
    }
    return false;
}

bool IsChecked(string nodeName, XmlNodeList nodes)
{
    foreach (XmlNode xNode in nodes)
    {
        if (xNode.Attributes != null &&
            xNode.Attributes["Name"] != null &&
            xNode.Attributes["Name"].Value == nodeName &&
            xNode.Attributes["CheckState"] != null &&
            xNode.Attributes["CheckState"].Value == "On"
        )
        {
            return true;
        }

        if (IsChecked(nodeName, xNode.ChildNodes))
        {
            return true;
        }
    }
    return false;
}
1 comment
Gary
Posted on: 15 Apr 2015 14:03
Yes this would be great.