We have had some recent requests to provide an example of using a coded step in WebUI Test Studio. Additionally, we have had a few inquiries asking how to verify items in a tree view. This post should address both questions!
The goal with this test is to use a data source to verify the contents of a tree view, the tree view I would like to verify contains (3) values, "Project", "Iteration 1" and "Iteration 2", see below image.
After creating a new test, the first thing I will do is utilize our local test data feature to create a '1' column, '3' row data source as shown below:
Next, I will record a couple steps that bring me to the point in which the Tree View appears on screen. Once on screen - I use the hover over highlighting to select the treeview control and add it into my element repository as shown below:
Last step is to add the coded step in using the 'Script Step' option on the ribbon. The code for this example is as follows:
Pages.TeamPulseManagePersonas0.SilverlightApp.HierarchyTreeViewRadtreeview.Find.ByText(Data["Col1"].ToString());
When using this example, please keep in mind that this code refrences elements that were in my element repository, specifically "TeamPulseManagePersonas0" and "HierarchyTreeViewRadtreeview". If these elements differ in your project, be sure to adjust your code accordingly.
If you would like additional detail, go to Telerik TV and view the recording of this Coded Step Example.