Reputation: 25
I have a web aplication with a combobox and a table of elements. I need to write a method using codedUI that selects an element of the combobox or from the table, passing as parameter the "name" of the element is it possible?
If more information is needed, please ask me
thanks
Upvotes: 2
Views: 1471
Reputation: 9783
You can record the action you want to test and then customize the auto-generated code inside the UIMap.Designer.cs
file to select the control you need. For each control you use when you record your test the CodedUi Test Builder
creates a new class inside this file. If your controls are similar (eg. control1, control2...) assign the parameter name to the Search Properties
of this control:
public class UIItemWindow : WinWindow
{
public UIItemWindow()
{
#region Search Criteria
//Here assign the paramter to the search properties of the control
this.SearchProperties[WinWindow.PropertyNames.Name] = parameterName;
#endregion
}
#region Properties
public UIItemWindow1 UIItemWindow1
{
get
{
if ((this.mUIItemWindow1 == null))
{
this.mUIItemWindow1 = new UIItemWindow1(this);
}
return this.mUIItemWindow1;
}
}
#endregion
#region Fields
private UIItemWindow1 mUIItemWindow1;
#endregion
}
To see how you can pass parameters to the CodedUI test check these links:
Upvotes: 1