本文主要是介绍AutoRunner 功能自动化测试项目实训之正儿八经的检查点(七),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
四.脚本检查点详细设计过程和回放实验
实验内容导航
1.实验步骤
2.实验需求
3.实验目标
4.实验理论
5.操作步骤
6.实验报告模板
7.实验课尾交流
实验步骤
1.理解脚本录制的原理
2.熟悉需要测试的功能的需求
3.认真分析实验需求
4.独立完成实验任务
5.认真填写实验报告,并细致分析与总结本次实验
实验需求
1.成功搭建被测系统crm客户管理平台;
2.成功安装AutoRunner功能自动化测试工具,可以录制回放脚本
3.使用IE浏览器,并且版本不超过IE9
实验目标
1.深入学习功能自动化测试工具的使用
2.掌握录制和回放的基本操作
3.熟悉脚本编辑区域的脚本信息
4.掌握检查点设置的方法和技巧
5.掌握报告结果的分析
实验理论
实验理论:自动化测试工程实际就是一个工具模拟人工的过程,这个过程可以细分成俩个独立又相互关联的阶段,首先是用自动化测试工具模拟记录人工的操作过程形成测试脚本,第二个阶段是自动化测试工具根据及录下的人工的操作步骤和后期设计的输入参数,自动循环往复执行重复的操作,对被测系统进行全方位立体式的测试,以期找出系统的所有缺陷。
在这个过程中我们除了掌握脚本的录制和参数化,正反例设计之外还需要掌握如何在脚本中添加检查点,以校验系统中数据传输或交易场景的逻辑和功能的正确性,这里需要熟练掌握函数checkProperty的含义和用法,下面我们从一个具体的实例出发深入学习下检查点的设置和在实际项目测试中如何运用。
在crm客户管理系统的客户管理模块中新增客户和客户管理模块中就存在数据的传输过程,在新增客户的时候我们可以选择新增的客户类型为:潜在客户、正式客户、放弃客户、签约客户,四大类;
在这个过程中,每添加一个客户都会进入到对应的模块中:
在这个过程中我们可以用自动化测试的方法来检测,添加过的客户是否进入了对应类型的客户列表里面了,举个例子,在新增客户模块新增一个公司名称为天启集团的潜在客户,然后进入潜在客户列表查看天启集团是否显示在潜在客户列表:
经过手工添加之后我们不难发现,添加成功了,并且在潜在客户信息列表中找到了对应的客户信息,而且我们发现这个列表的排序非常有意思,这个列表正好是倒序排列的,这个在后续添加检查点的时候可以为我们省去不少麻烦。
手动登录之后进入系统桌面,这里我们自动化测试脚本直接从登录之后开始录制
点击客户管理展开客户管理模块下面的子模块,点击新增客户,添加客户信息选择添加潜在客户,添加完成后进入潜在客户信息列表,检查是否添加成功:
参数表:
脚本如下:
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_客户管理", 72, 7, "left");
for(ParameterData pd : ar.getParameterDataList("add_cilent.xls")/*.subList(0, 3)*/)
{
//ar.parameterData = pd;//ar.parameterData可用于脚本之间传递参数
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_新增客户", 24, 2, "left");
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("INPUT_text_Client_Company", 74, 12, "left");
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").setValue("INPUT_text_Client_Company", ""+pd.getFrom("company"));
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("INPUT_submit_确 认", 59, 9, "left");
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_潜在客户", 14, 8, "left");
if (ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").controlExist("TD")){
System.out.println("新增成功!");
}
}
脚本执行结果:
日志信息:
脚本详细:
行号 | 脚本内容 | |
1 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_客户管理", 72, 7, "left"); | |
2 | for(ParameterData pd : ar.getParameterDataList("add_cilent.xls")/*.subList(0, 3)*/) | |
3 | { | |
4 | //ar.parameterData = pd;//ar.parameterData可用于脚本之间传递参数 | |
5 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_新增客户", 24, 2, "left"); | |
6 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("INPUT_text_Client_Company", 74, 12, "left"); | |
7 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").setValue("INPUT_text_Client_Company", ""+pd.getFrom("company")); | |
8 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("INPUT_submit_确 认", 59, 9, "left"); | |
9 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_潜在客户", 14, 8, "left"); | |
10 | if (ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").controlExist("TD")){ | |
11 | System.out.println("新增成功!"); | |
12 | } | |
13 | } | |
|
|
记录详细:
行号 | 对象 | 详细 | 结果 | 时间 | 备注 |
1 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:52:41 |
|
1 | A_客户管理 | clickControl | Successed | 2019-10-28 10:52:43 |
|
2 | add_cilent.xls | getParameterDataList | Successed | 2019-10-28 10:52:44 |
|
5 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:52:44 |
|
5 | A_新增客户 | clickControl | Successed | 2019-10-28 10:52:45 |
|
6 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:52:45 |
|
6 | INPUT_text_Client_Company | clickControl | Successed | 2019-10-28 10:52:47 |
|
7 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:52:47 |
|
7 | INPUT_text_Client_Company | setValue | Successed | 2019-10-28 10:52:48 |
|
8 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:52:49 |
|
8 | INPUT_submit_确 认 | clickControl | Successed | 2019-10-28 10:52:50 |
|
9 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:52:50 |
|
9 | A_潜在客户 | clickControl | Successed | 2019-10-28 10:52:51 |
|
10 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:52:52 |
|
10 | TD | controlExist | Successed | 2019-10-28 10:52:54 |
|
5 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:52:54 |
|
5 | A_新增客户 | clickControl | Successed | 2019-10-28 10:52:55 |
|
6 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:52:56 |
|
6 | INPUT_text_Client_Company | clickControl | Successed | 2019-10-28 10:52:57 |
|
7 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:52:57 |
|
7 | INPUT_text_Client_Company | setValue | Successed | 2019-10-28 10:52:59 |
|
8 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:52:59 |
|
8 | INPUT_submit_确 认 | clickControl | Successed | 2019-10-28 10:53:00 |
|
9 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:53:01 |
|
9 | A_潜在客户 | clickControl | Successed | 2019-10-28 10:53:02 |
|
10 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:53:02 |
|
10 | TD | controlExist | Successed | 2019-10-28 10:53:05 |
|
5 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:53:05 |
|
5 | A_新增客户 | clickControl | Successed | 2019-10-28 10:53:06 |
|
6 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:53:06 |
|
6 | INPUT_text_Client_Company | clickControl | Successed | 2019-10-28 10:53:07 |
|
7 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:53:08 |
|
7 | INPUT_text_Client_Company | setValue | Successed | 2019-10-28 10:53:09 |
|
8 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:53:09 |
|
8 | INPUT_submit_确 认 | clickControl | Successed | 2019-10-28 10:53:10 |
|
9 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:53:11 |
|
9 | A_潜在客户 | clickControl | Successed | 2019-10-28 10:53:12 |
|
10 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 10:53:12 |
|
10 | TD | controlExist | Successed | 2019-10-28 10:53:14 |
|
|
|
|
|
|
|
结果总结:
名称 | 值 |
脚本名称: | add_cilent.bsh |
录像文件: |
|
开始执行时间: | 2019-10-28 10:52:40 |
执行结束时间: | 2019-10-28 10:53:14 |
执行耗时(秒): | 34 |
脚本执行结果: | 执行成功! |
脚本执行结果:
在以上的操作中,只是单纯地正常添加了不重复的客户信息,还有添加客户信息重复、添加公司名称为空的客户信息。这俩种情况没有考虑,在实际的软件测试过程中,需要考虑测试的覆盖率,因此需要对脚本进行强化,在脚本后期强化考虑到,实际情况的复杂性分出一下三种情况,第一:正常添加公司名称不重复且公司名称不为空的客户信息,添加成功后校验添加的客户信息是否成功显示在对应的客户信息列表里,并打印结果“添加客户成功!”;第二:填写公司名称重复的客户信息,添加失败,将失败的结果打印到输出;第三:添写公司名称为空的客户信息,添加失败,将添加失败的结果打印到输出方便统计测试执行结果。



首先记录添加重复的公司名称的客户信息,(记得如果网页上方有加载信息提示,需要点击启用,否则可以添加重复的公司名称的客户信息,而没有添加客户信息冲突的提示)记录脚本的位置是在点击确定按钮之后,首先点击提示框内部的空白区域,然后强抓“客户冲突!请检索后添加!”:
然后点击确定按钮:
然后将脚本中的注释部分删除:
接下来需要对客户冲突这种情况,进行判断,对脚本进行如下编辑:
接下来用类似的方式将添加公司名称为空的情况记录成脚本:
然后将注释的脚本删除:
对脚本进行编辑:
做完了以上的操作,前面俩种情况都分析完毕了,下面可以对添加不重复不为空的公司名称的客户信息的情况进行脚本处理:
首先添加校验点,检验信息列表里面的客户公司名称是否与添加的一致:
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").checkProperty("TD", "innerText", "");
在上面的这行脚本里面,校验的预期结果不妨从参数表里面去取值:
则脚本可修改为(注意:company前面有俩个空格):
脚本内容:ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").checkProperty("TD", "innerText", ""+pd.getFrom(" company"));
在完成了上面的操作之后,需要对脚本中的判断条件进行编辑:
完整的测试脚本如下:
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_客户管理", 72, 7, "left");
for(ParameterData pd : ar.getParameterDataList("add_cilent.xls")/*.subList(0, 3)*/)
{
//ar.parameterData = pd;//ar.parameterData可用于脚本之间传递参数
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_新增客户", 24, 2, "left");
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("INPUT_text_Client_Company", 74, 12, "left");
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").setValue("INPUT_text_Client_Company", ""+pd.getFrom("company"));
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("INPUT_submit_确 认", 59, 9, "left");
if (ar.windowExist("#32770_来自网页的消息")){
ar.window("#32770_来自网页的消息").clickControl("Button_确定", 35, 15, "left");
}else if (ar.windowExist("#32770_来自网页的消息_2")){
ar.window("#32770_来自网页的消息_2").clickControl("Button_确定_2", 64, 9, "left");
}else{
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_潜在客户", 14, 8, "left");
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").checkProperty("TD", "innerText", ""+pd.getFrom(" company"));
System.out.println("新增成功!");
}
}
下面执行编辑好的测试脚本:
日志信息:
脚本详细:
行号 | 脚本内容 |
1 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_客户管理", 72, 7, "left"); |
2 | for(ParameterData pd : ar.getParameterDataList("add_cilent.xls")/*.subList(0, 3)*/) |
3 | { |
4 | //ar.parameterData = pd;//ar.parameterData可用于脚本之间传递参数 |
5 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_新增客户", 24, 2, "left"); |
6 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("INPUT_text_Client_Company", 74, 12, "left"); |
7 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").setValue("INPUT_text_Client_Company", ""+pd.getFrom("company")); |
8 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("INPUT_submit_确 认", 59, 9, "left"); |
9 | if (ar.windowExist("#32770_来自网页的消息")){ |
10 | ar.window("#32770_来自网页的消息").clickControl("Button_确定", 35, 15, "left"); |
11 | }else if (ar.windowExist("#32770_来自网页的消息_2")){ |
12 | ar.window("#32770_来自网页的消息_2").clickControl("Button_确定_2", 64, 9, "left"); |
13 | }else{ |
14 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_潜在客户", 14, 8, "left"); |
15 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").checkProperty("TD", "innerText", ""+pd.getFrom(" company")); |
16 | System.out.println("新增成功!"); |
17 | } |
18 | } |
|
|
记录详细:
行号 | 对象 | 详细 | 结果 | 时间 | 备注 |
1 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 13:18:47 |
|
1 | A_客户管理 | clickControl | Successed | 2019-10-28 13:18:48 |
|
2 | add_cilent.xls | getParameterDataList | Successed | 2019-10-28 13:18:49 |
|
5 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 13:18:49 |
|
5 | A_新增客户 | clickControl | Successed | 2019-10-28 13:18:50 |
|
6 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 13:18:50 |
|
6 | INPUT_text_Client_Company | clickControl | Successed | 2019-10-28 13:18:51 |
|
7 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 13:18:52 |
|
7 | INPUT_text_Client_Company | setValue | Successed | 2019-10-28 13:18:53 |
|
8 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 13:18:53 |
|
8 | INPUT_submit_确 认 | clickControl | Successed | 2019-10-28 13:18:54 |
|
14 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 13:19:06 |
|
14 | A_潜在客户 | clickControl | Successed | 2019-10-28 13:19:07 |
|
15 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 13:19:07 |
|
15 | TD | checkProperty | Failed | 2019-10-28 13:19:08 | 天启集团11 |
5 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 13:19:08 |
|
5 | A_新增客户 | clickControl | Successed | 2019-10-28 13:19:09 |
|
6 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 13:19:09 |
|
6 | INPUT_text_Client_Company | clickControl | Successed | 2019-10-28 13:19:10 |
|
7 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 13:19:11 |
|
7 | INPUT_text_Client_Company | setValue | Successed | 2019-10-28 13:19:12 |
|
8 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 13:19:12 |
|
8 | INPUT_submit_确 认 | clickControl | Successed | 2019-10-28 13:19:14 |
|
10 | #32770_来自网页的消息 | window | Successed | 2019-10-28 13:19:14 |
|
10 | Button_确定 | clickControl | Successed | 2019-10-28 13:19:14 |
|
5 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 13:19:15 |
|
5 | A_新增客户 | clickControl | Successed | 2019-10-28 13:19:16 |
|
6 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 13:19:16 |
|
6 | INPUT_text_Client_Company | clickControl | Successed | 2019-10-28 13:19:17 |
|
7 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 13:19:18 |
|
7 | INPUT_text_Client_Company | setValue | Successed | 2019-10-28 13:19:19 |
|
8 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 13:19:19 |
|
8 | INPUT_submit_确 认 | clickControl | Successed | 2019-10-28 13:19:20 |
|
12 | #32770_来自网页的消息_2 | window | Successed | 2019-10-28 13:19:26 |
|
12 | Button_确定_2 | clickControl | Successed | 2019-10-28 13:19:27 |
|
|
|
|
|
|
|
结果总结:
名称 | 值 |
脚本名称: | add_cilent.bsh |
录像文件: |
|
开始执行时间: | 2019-10-28 13:18:46 |
执行结束时间: | 2019-10-28 13:19:27 |
执行耗时(秒): | 41 |
脚本执行结果: | 执行成功! |
脚本的执行结果:
在结构里面只有添加成功的情况下有校验和输出,接下来对脚本进行进一步的编辑,把添加公司名称重复的客户信息和添加公司名称为空的客户信息的情况下的执行结果都打印到输出,这里的做法和登录模块中,用户名不存在、密码错误的处理方式一模一样:
1.“客户冲突!请检索后添加!”的结果打印到输出的脚本:
String str1 = ar.window("#32770_来自网页的消息").getProperty("Static_客户冲突!请检索后再添加!", "name");
System.out.println(str1);
2.“单位名称不能为空!”的结果打印到输出的脚本:
String str2 = ar.window("#32770_来自网页的消息_2").getProperty("Static_单位名称不能为空!", "name");
System.out.println(str2);
处理完成后的完整脚本如下:
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_客户管理", 72, 7, "left");
for(ParameterData pd : ar.getParameterDataList("add_cilent.xls")/*.subList(0, 3)*/)
{
//ar.parameterData = pd;//ar.parameterData可用于脚本之间传递参数
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_新增客户", 24, 2, "left");
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("INPUT_text_Client_Company", 74, 12, "left");
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").setValue("INPUT_text_Client_Company", ""+pd.getFrom("company"));
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("INPUT_submit_确 认", 59, 9, "left");
if (ar.windowExist("#32770_来自网页的消息")){
String str1 = ar.window("#32770_来自网页的消息").getProperty("Static_客户冲突!请检索后再添加!", "name");
System.out.println(str1);
ar.window("#32770_来自网页的消息").clickControl("Button_确定", 35, 15, "left");
}else if (ar.windowExist("#32770_来自网页的消息_2")){
String str2 = ar.window("#32770_来自网页的消息_2").getProperty("Static_单位名称不能为空!", "name");
System.out.println(str2);
ar.window("#32770_来自网页的消息_2").clickControl("Button_确定_2", 64, 9, "left");
}else{
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_潜在客户", 14, 8, "left");
ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").checkProperty("TD", "innerText", ""+pd.getFrom("company"));
System.out.println("新增成功!");
}
}
参数表:注意实际结果,也就是客户信息列表里面的公司名称前是有俩个空格的,所以我们在参数表里给不重复也不为空的公司名称前面加俩个空格,这样校验结果就可以返回布尔值“true”了。
接下来又到了激动人心的脚本执行阶段:
脚本执行结果:
日志信息:
脚本详细:
行号 | 脚本内容 |
1 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_客户管理", 72, 7, "left"); |
2 | for(ParameterData pd : ar.getParameterDataList("add_cilent.xls")/*.subList(0, 3)*/) |
3 | { |
4 | //ar.parameterData = pd;//ar.parameterData可用于脚本之间传递参数 |
5 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_新增客户", 24, 2, "left"); |
6 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("INPUT_text_Client_Company", 74, 12, "left"); |
7 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").setValue("INPUT_text_Client_Company", ""+pd.getFrom("company")); |
8 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("INPUT_submit_确 认", 59, 9, "left"); |
9 | if (ar.windowExist("#32770_来自网页的消息")){ |
10 | String str1 = ar.window("#32770_来自网页的消息").getProperty("Static_客户冲突!请检索后再添加!", "name"); |
11 | System.out.println(str1); |
12 | ar.window("#32770_来自网页的消息").clickControl("Button_确定", 35, 15, "left"); |
13 | }else if (ar.windowExist("#32770_来自网页的消息_2")){ |
14 | String str2 = ar.window("#32770_来自网页的消息_2").getProperty("Static_单位名称不能为空!", "name"); |
15 | System.out.println(str2); |
16 | ar.window("#32770_来自网页的消息_2").clickControl("Button_确定_2", 64, 9, "left"); |
17 | }else{ |
18 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").clickControl("A_潜在客户", 14, 8, "left"); |
19 | ar.window("IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer").checkProperty("TD", "innerText", ""+pd.getFrom("company")); |
20 | System.out.println("新增成功!"); |
21 | } |
22 | } |
|
|
记录详细:
行号 | 对象 | 详细 | 结果 | 时间 | 备注 |
1 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 20:45:18 |
|
1 | A_客户管理 | clickControl | Successed | 2019-10-28 20:45:19 |
|
2 | add_cilent.xls | getParameterDataList | Successed | 2019-10-28 20:45:20 |
|
5 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 20:45:20 |
|
5 | A_新增客户 | clickControl | Successed | 2019-10-28 20:45:22 |
|
6 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 20:45:22 |
|
6 | INPUT_text_Client_Company | clickControl | Successed | 2019-10-28 20:45:23 |
|
7 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 20:45:24 |
|
7 | INPUT_text_Client_Company | setValue | Successed | 2019-10-28 20:45:25 |
|
8 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 20:45:25 |
|
8 | INPUT_submit_确 认 | clickControl | Successed | 2019-10-28 20:45:26 |
|
18 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 20:45:38 |
|
18 | A_潜在客户 | clickControl | Successed | 2019-10-28 20:45:39 |
|
19 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 20:45:40 |
|
19 | TD | checkProperty | Successed | 2019-10-28 20:45:41 | 天启集团14 |
5 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 20:45:41 |
|
5 | A_新增客户 | clickControl | Successed | 2019-10-28 20:45:41 |
|
6 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 20:45:42 |
|
6 | INPUT_text_Client_Company | clickControl | Successed | 2019-10-28 20:45:43 |
|
7 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 20:45:43 |
|
7 | INPUT_text_Client_Company | setValue | Successed | 2019-10-28 20:45:44 |
|
8 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 20:45:45 |
|
8 | INPUT_submit_确 认 | clickControl | Successed | 2019-10-28 20:45:46 |
|
10 | #32770_来自网页的消息 | window | Successed | 2019-10-28 20:45:46 |
|
10 | Static_客户冲突!请检索后再添加! name | getProperty | 客户冲突!请检索后再添加! | 2019-10-28 20:45:47 |
|
12 | #32770_来自网页的消息 | window | Successed | 2019-10-28 20:45:47 |
|
12 | Button_确定 | clickControl | Successed | 2019-10-28 20:45:47 |
|
5 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 20:45:48 |
|
5 | A_新增客户 | clickControl | Successed | 2019-10-28 20:45:49 |
|
6 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 20:45:49 |
|
6 | INPUT_text_Client_Company | clickControl | Successed | 2019-10-28 20:45:50 |
|
7 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 20:45:51 |
|
7 | INPUT_text_Client_Company | setValue | Successed | 2019-10-28 20:45:52 |
|
8 | IEFrame_上海泽众软件科技有限公司客户管理系统 - Windows Internet Explorer | window | Successed | 2019-10-28 20:45:52 |
|
8 | INPUT_submit_确 认 | clickControl | Successed | 2019-10-28 20:45:53 |
|
14 | #32770_来自网页的消息_2 | window | Successed | 2019-10-28 20:45:59 |
|
14 | Static_单位名称不能为空! name | getProperty | 单位名称不能为空! | 2019-10-28 20:46:00 |
|
16 | #32770_来自网页的消息_2 | window | Successed | 2019-10-28 20:46:00 |
|
16 | Button_确定_2 | clickControl | Successed | 2019-10-28 20:46:00 |
|
|
|
|
|
|
|
结果总结:
名称 | 值 |
脚本名称: | add_cilent.bsh |
录像文件: |
|
开始执行时间: | 2019-10-28 20:45:17 |
执行结束时间: | 2019-10-28 20:46:01 |
执行耗时(秒): | 43 |
脚本执行结果: | 执行成功! |
输出结果:
这篇关于AutoRunner 功能自动化测试项目实训之正儿八经的检查点(七)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!