基于UFT12.0,满足N个用户申请新店铺需求的测试脚本的自动化实现

简单说明:脚本实现了数据和业务相分离,即数据录入和脚本开发可以由不同的人去完成。 

                 假设数据Excel表已完成,之后可以分三步走

                 1.按需求将所需的对象保存到对象库中

                 2.按需求步骤和自己的逻辑完成代码录入,代码如下

                 3.在运行脚本之前,需要在UFT里面的文件——设置——运行——只运行一次迭代。 

DataTable.Import("C:\Users\LM\Desktop\ShopTask.xlsx")

For i  =  1  To  2  Step  1

CurrentRow  = DataTable.GetSheet ( "Global" ).GetCurrentRow
DataTable.GetSheet ( "Global" ).SetCurrentRow (i )

With Browser ( "会员登录" ).Page ( "会员登录" )    
    .WebEdit ( "j_username1" ). Set DataTable ( "用户名", "Global" )
    .WebEdit ( "j_password" ). Set DataTable ( "密码", "Global" )
    .WebButton ( "登录" ).Click
End  With
Browser ( "会员登录" ).Page ( "完善信息 | 数字本草" ).Link ( "卖家中心" ).Click

With Browser ( "会员登录" ).Page ( "数字本草" )
    

    .Link ( "基础信息" ).Click
    .WebEdit ( "name" ). Set DataTable ( "店铺名称", "Global" )
    .WebEdit ( "description" ). Set  DataTable ( "店铺简介", "Global" )
    .WebEdit ( "contactName1" ). Set  DataTable ( "联系人1", "Global" )
    .WebEdit ( "contactPhone1" ). Set  DataTable ( "联系人1电话", "Global" )

    .WebEdit ( "contactName2" ). Set  DataTable ( "联系人2", "Global" )
    .WebEdit ( "contactPhone2" ). Set  DataTable ( "联系人2电话", "Global" )
    .WebEdit ( "contactName3" ). Set  DataTable ( "联系人3", "Global" )
    .WebEdit ( "contactPhone3" ). Set  DataTable ( "联系人3电话", "Global" )
    .WebEdit ( "telephone" ). Set  DataTable ( "座机号", "Global" )
    .WebEdit ( "fax" ). Set  DataTable ( "传真", "Global" )
    .WebEdit ( "qq" ). Set  DataTable ( "QQ", "Global" )
    
    
    .WebList ( "countryIso" ). Select  DataTable ( "国家", "Global" )
    .WebList ( "regionIso" ). Select  DataTable ( "省份", "Global" )
    .WebList ( "cityCode" ). Select  DataTable ( "市级", "Global" )
    .WebList ( "cityDistrictCode" ). Select  DataTable ( "地区", "Global" )
    .WebEdit ( "street" ). Set  DataTable ( "街道", "Global" )
    .WebButton ( "提交" ).Click
End  With
Browser ( "数字本草" ).Page ( "数字本草" ).Link ( "[退出]" ).Click




Next














  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值