老宋的地盘

 找回密码
 我要加入
搜索
查看: 2851|回复: 0

RFT自动化脚本编写步骤

[复制链接]
发表于 2013-5-23 08:22:35 | 显示全部楼层 |阅读模式
3.测试框架中的测试对象封装:比如Button
         /**
          * 判断是否可用
          * @return
          */
         public boolean isDisabled(){
                   if(this.getProperty(".disabled").toString().equals("true")){
                            return true;
                   }else{
                            return false;
                   }
         }
         
         /**
          * 判断是否只读
          * @return
          */
         public boolean isReadOnly(){
                   if(this.getProperty(".readOnly").toString().equals("true")){
                            return true;
                   }else{
                            return false;
                   }
         }
         
         /**
          * 判断是否被选者中
          * @return
          */
         public boolean isChecked(){
                   if(this.getProperty(".checked").toString().equals("true")){
                            return true;
                   }else{
                            return false;
                   }
         }
         
         /**
          * 返回文本值
          * @return
          */
         public String getText(){
                   return this.getProperty(".text").toString();
         }
4.rft抓取测试对象,编写查询按钮的对应的配置文件
<widget name='查询' method='atDescendant'>        
<property name='.class' type='all'>Html.INPUT.button</property>
<property name='.value' type='all'>查询</property>
</widget>
5.根据测试对象配置文件写测试对象脚本,比如:查询按钮
/**
     * 查询按钮
     * @return
     */
    public Button getQueryBtt(){
       return new Button(sf.findWidget(root, "查询"));
    }
6.编写查询按钮的关键字,即查询的方法,如单击click,调用的是对象脚本
/**
     * 查询:点击查询按钮
     */
    public void clickQueryBtt() {
       zj.getQueryBtt().click();
    }
7.用关键字转化文件将查询按钮的关键字转化为对应的配置文件
<keyword name="查询" type="S">
      <method sign="N">clickQueryBtt</method>
</keyword>
8.编写测试用例
keyword
测试步骤
预期响应
验证点名称
验证方法
预期验证信息
验证级别
测试数据1
备注
查询
点击“查询”按钮
显示所有的计划总结
9.编写测试用例配置文件
<case name="H_TopOA_计划总结_新增计划">
<excel>com\\topnet\\autotest\\autooa\\cases\\docs\\计划总结\\计划总结\\H_TopOA_计划总结_新增计划.xls</excel>
<src>com.topnet.autotest.autooa.cases.src.mana.jhzj.H_Jhzj_xzjh</src>
<keyword>com\\topnet\\autotest\\autooa\\actions\\conf\\mana\\jhzj.keyword.xml</keyword>
</case>
10.根据测试用例excel和关键字配置文件,用测试用例转化文件生成测试用例脚本
key.clickQueryBtt();
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

歌名 - 歌手
0:00

    QQ|手机版|小黑屋|老宋 ( 备案中... )

    GMT+8, 2024-4-29 19:02 , Processed in 0.086665 second(s), 22 queries , Gzip On.

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

    快速回复 返回顶部 返回列表