2012-04-24 90 views
1

我有一个带有组合框和元素表的web应用程序。我需要编写一个使用codedUI的方法来选择组合框的一个元素,或者从表中传递参数作为元素的“名称”。使用CodedUI在组合框或表格中选择特定值

如果需要了解更多信息,请向我

感谢

回答

0

您可以录制你想要测试,然后自定义UIMap.Designer.cs文件中自动生成的代码来选择您需要的控制作用。对于记录测试时使用的每个控件,CodedUi Test Builder在该文件内创建一个新类。如果你的控件类似于参数名称分配给此控件的Search Properties(如控制1,控制2 ...。):

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 
} 

要看看如何将参数传递给CodedUI测试检查这些链接: