标签:http io ar os 使用 sp strong on 数据
自带验证点:图形界面insert -> checkpoint
Standard Checkpoint 标准验证:用于检查测试对象的属性
Text Checkpoint 文本验证:用于检查文本字符串是否在应用程序中的适当位置出现
Text Area Checkpoint文本区域验证:用于检查文本字符串是否按既定的标准出现在应用程序的预定区域
Bitmap Checkpoint 位图验证:用于检查被测试应用程序的某个区域当成位图来检查
Database Checkpoint 数据库验证
Accessibility Checkpoint 热键,快捷键验证
Example1:验证登录按钮文字为“OK”
步骤:点击Record,在Flight程序输入用户名和密码,点击insert ->checkpoint-> Text Checkpoint
Ignore spaces 忽略空格
Text not display检查文本不显示出来
Record代码:
Dialog(“Login”).Activate Dialog(“Login”).WinEdit(“Agent Name:”).Set”mercury” Dialog(“Login”).WinEdit(“Password:”).Set”mercury” Dialog(“Login”).WinButton(“OK”).Check CheckPoint(“OK”) Details: Test Checkpoint:captured”OK” Match case:OFF Exact match:OFF Ignore spaces:ON |
Example2:手工添加对象,检查错误登录是否有相应提示,通过Checkproperty(手工编写代码,无需录制)操作
步骤:点击Record,在Flight程序不输入用户名mer和密码,提示“Agent name must be at least 4 characters long.”,Object Repository->Add Objects to Local->添加文本对象 “Agent name must be at least 4 characters long.”
Record代码:
Dialog("Login").WinEdit("Agent Name: ").Set"mer" Dialog("Login").WinButton("OK").Click Dialog("Login").Dialog("Flight Reservation").Static("emmsg").CheckProperty"text"," Agent name must be at least 4 characters long. "(手工添加) Dialog("Login"). Dialog("Flight Reservation").WinButton("确定").Click |
Details:Property "text" has the expected value "Agent name must be at least 4 characters long. "
Practice1:验证Agileone登录页面用户名正确,密码错误的提示“出错啦: 密码输入错误 …”
步骤:点击Record,在internet explorer 8 输入http://localhost/agileone,用户名输入:admin,密码输入:123,点击登录按钮,点击stop
Record代码:
Browser("AgileOne - Welcome to").Page("AgileOne - Welcome to").WebEdit("WebEdit").Set "admin" Browser("AgileOne - Welcome to").Page("AgileOne - Welcome to").WebEdit("WebEdit_2").Set "2313" Browser("AgileOne - Welcome to").Page("AgileOne - Welcome to").Image("loginbt").Click Browser("AgileOne - Welcome to").Page("AgileOne - Welcome to").WebElement ("errmsg"). CheckProperty "innertext", "出错啦: 密码输入错误 ..." (手工添加) Details:Passed |
手工测试点:做自定义验证,report对象自定义报告的内容
Example3:自定义报告内容(Flight程序)
Dialog(“Login”).WinEdit(“Agent Name:”).Set”mer” Dialog(“Login”).WinButton(“OK”).Click expected_result = "Agent name must be at least 4 characters long. " actual_result = dialog("Login").Dialog("Flight Reservations").Static(errmsg).GetROProperty("text") If expected_result = actual_result Then reporter.ReportEvent micPass, "登陆验证","使用不足4位的用户名登录时,弹出的错误提示内容正确!" else reporter.ReportEvent micFile, "登陆验证","使用不足4位的用户名登录时,弹出的错误提示内容错误!" End If Dialog(“Login”). Dialog("Flight Reservation").WinButton(“确定”).Click |
Objict:登陆验证
details:当使用不足4位的用户名登录时,弹出的错误提示内容正确!
注:
① 参数有返回值就要打括号,没有返回值不打括号
② 参数与函数之间要留空格
③ 链接号用&,如需要打印actual_result时:reporter.ReportEvent micPass, "登陆验证”,”当使用不足4位的用户名登录时,弹出的错误提示内容正确!"&actual_result
Practice1:验证Agileone登录页面用户名正确,密码错误的提示“出错啦: 密码输入错误 …”,自定义报告
Record代码:
Browser("AgileOne - Welcome to").Page("AgileOne - Welcome to").WebEdit("WebEdit").Set "admin" Browser("AgileOne - Welcome to").Page("AgileOne - Welcome to").WebEdit("WebEdit_2").Set "2313" Browser("AgileOne - Welcome to").Page("AgileOne - Welcome to").Image("loginbt").Click expected_result = "出错啦: 密码输入错误 ..." actual_result = Browser("AgileOne - Welcome to").Page("AgileOne - Welcome to").WebElement("errmsg"). GetROProperty("innertext") If expected_result = actual_result Then reporter.ReportEvent micPass, "登陆验证","当密码出错登录时弹出的错误提示内容正确!" else reporter.ReportEvent micFile, "登陆验证","当密码出错登录时弹出的错误提示内容错误!" End If |
Object:登陆验证
Details:当密码出错登录时弹出的错误提示内容正确!
Result:passed
标签:http io ar os 使用 sp strong on 数据
原文地址:http://www.cnblogs.com/wont/p/4152622.html