功能测试中自动化测试框架的分析和应用03-对象库的实现

上一篇 / 下一篇  2017-12-29 16:59:25 / 个人分类:自动化测试实践

这几天码代码有点多,不太想打字,贴一部分代码记录一下:

//要确定一个界面元素主要的参数有以下几个:ControlNameLocalizedControlTypeNameAutomationId

//自动化元素的类定义

private ControlType controlType;

       private string name;

       private string localizedControlType;

       private string automationId;

 

       public ElementDefine(ControlType conType, string name, string LCtype, string automationId)

       {

           this.controlType = conType;

           this.name = name;

           this.localizedControlType = LCtype;

           this.automationId = automationId;

       }

       public ControlType ControlType { get { return controlType; } set { } }

       public string Name { get { return name; } set { } }

       public string LocalizedControlType { get { return localizedControlType; } set { } }

       public string AutomationId { get { return automationId; } set { }

 

//根据对象属性返回对象的方法

Public AutomationElement GetElementByDescendants(AutomationElement parentWindowHandle){…}

//根据controlPattern定义的方法

public bool ElementInvoke(AutomationElement ipe)//invoke pattern element

public bool ElementValuePattern(AutomationElement vpe, string value)//value pattern element

public bool ElementTextPattern(AutomationElement tpe, string value)//text pattern element

}

 

//UI界面元素对象初始化:

ElementDefine loginElement = new ElementDefine(ControlType.Button, "用户登录", "按钮",””);//构造函数中对元素的参数进行初始化


TAG:

 

评分:0

我来说两句

日历

« 2024-04-26  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 10175
  • 日志数: 9
  • 建立时间: 2017-12-20
  • 更新时间: 2018-01-23

RSS订阅

Open Toolbar