QTP参数化的三种方式

上一篇 / 下一篇  2010-03-09 19:02:47 / 个人分类:QTP

一、参数化

 1、数据表参数化

 2、使用随机数参数化

 eg:'取得航班列表的行数

     ItemCount=Window("Flight Reservation").Dialog("Flights Table").WinList("From").GetItemsCount

     '随机选取其中一项

     SelectItem=RandomNumber(0,ItemCount)

     '选择航班

     Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select  SelectItem

 3、环境变量的参数化

  File|Settings->Environment->Used-defined

二、使用数据驱动器参数化测试

  帮助测试人员快速找到需要参数化的测试对象、检查点的数据

  Tools|Data Driver-Paramererize

三、Action测试输入的参数化

 参数化步骤:

     1、选择Action1所在的行,单击鼠标右键,选择菜单"Action Properties”,输入name和description.

     2、切换到parameters页,单击“+”按钮,添加调用Action需要输入的参数名和类型

     3、参数化设置的测试步骤

 调用Action步骤:

      1、在Action的测试步骤中,选择"Insert|Call to Existing Action”插入现有的Action

      2、选中插入Action所在的行,单击鼠标右键,选中菜单"Action Call Properties”,在"Parameter Value”页中,为每一个参数设置输入的参数值,也可以为输入绑定到Data Table中的数据

     代码举例:SystemUtil.Run "D\Program Files\Mercury Interactive\......\flight4a.exe"

              RunAction "Login_Action",oneiteration,"MERCURY","MERCURY"

 

 

 


TAG:

 

评分:0

我来说两句

Open Toolbar