Winrunner教程_基础篇
合集下载
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
• When WinRunner learns the description of a GUI object, it looks at the object’s physical properties. Each GUI object has many physical properties such as class, label, width, height, handle, and enabled to name a few. WinRunner only learns the properties it needs to uniquely distinguish an object from all other objects in the application.
Winrunner 测试流程
• 官方推荐
ONLY FOR SUI Map
• GUI applications are made up of GUI objects such as windows, buttons, lists, and menus.
• GUI Map指图形用户接口地图,Winrunner正是通过这张地图来找到 软件中的每一个按键、输入框等等。
• WinRunner stores the information it learns in a GUI map. When WinRunner runs a test, it uses the GUI map to locate objects: It reads an object’s description in the GUI map and then looks for an object with the same properties in the application being tested.
• 我们用Verify模式来运行我们的脚本,运行过程中程序记录各种错误和异常并 记录在测试结果。我们可以一次批量运行多个测试脚本。普通模式下,当测试 任务执行错误时,系统会提示是否继续运行。 • 在批量模式下,任何错误都不会打断测试任务继续进行。因此,我们可以在无 人看守的情况下运行脚本,例如在深夜运行它们。
• Setting Your Preferred GUI Map File Mode
– By default, WinRunner is set to the Global GUI Map File mode. To change the mode to the GUI Map File per Test mode choose Tools > General Options, select the General category, and select GUI Map File per Test. Click OK to close the dialog box.
• The Global GUI Map File Mode
– In the Global GUI Map File mode, you can use a single GUI map for a group of tests. When you work in the Global GUI Map File mode, you need to save the information that WinRunner learns about the properties into a GUI map file. When you run a test, you must load the appropriate GUI map file. – If you are familiar with WinRunner or with testing, it is probably most efficient to work in the Global GUI Map File mode.
ONLY FOR SJCU Presentation
流程 1. Create GUI Map 演示–制作一个GUI Map
Refer to Lesson 3
ONLY FOR SJCU Presentation
流程 2. Create Tests
• Winrunner有两种录制模式:Context Sensitive和Analog。
ONLY FOR SJCU Presentation
流程 6. Report Defects
Refer C:\Program Files\Mercury Interactive\WinRunner\samples\flight\tests\instords
APP:ONLY FOR SJCU Presentation C:\Program Files\Mercury Interactive\WinRunner\samples\flight\app\flight1a.exe
ONLY FOR SJCU Presentation
Winrunner 简介
• HP (Mercury) WinRunner为我们提供有力的工具进行企业级自动化 的功能测试和回归测试。它自动捕获、验证并重放用户交互,以便 确定故障并确保部署中的业务流程能顺利实施并保持稳定。 • 一般运用于功能测试和回归测试。 • 优点
Winrunner 工具介绍
(基础篇)
顾文炯 @ SJCU. 04/21/2010
目录
Winrunner 简介 Winrunner 实例演示
Winrunner 测试流程和演示
Winrunner 检查点和演示 Q & A
ONLY FOR SJCU Presentation
Winrunner 简介
ONLY FOR SJCU Presentation
流程 3. Debug Tests演示–Debug 一个脚本
F6 step by step Right-click specific line
Refer to Lesson 3
ONLY FOR SJCU Presentation
流程 4. Run Tests
– Context Sensitive模式录制我们对每个组件的操作行为,但是并不录制你的鼠标轨 迹。 – Analog模式也录制你的鼠标轨迹。因此,当我们测试绘图板之类的与路径相关的软 件时,才会用到这种模式。
• Winrunner录制我们操作软件的过程,并把它自动转化为测试脚本语言 (TSL)。 • 当我们录制好一段脚本后,我们可以修改自动生成的脚本,用运TSL使我们的 脚本更加聪明,例如识别错误、查看某短文字是否出现在界面中等等
• 根据典型软件生命周期模型,按阶段来分,软件测试分为以下阶段
– – – – – 单元测试 集成测试 确认测试 系统测试 回归测试
以上测试工作若全部由手工测试完成,那不但工作效率低下,而且很容易引入人工的 错误。因此,在当今的测试技术领域,一般引进自动化测试的方法。
• 自动化测试是指利用软件工具来控制测试的执行,进行预测与实际结 果的比较,并且自动生成测试报告等一系列的功能 :
– In the GUI Map File per Test mode, a GUI map file is created automatically every time you create a new test. The GUI map file that corresponds to your test is automatically saved whenever you save your test and automatically loaded whenever you open your test. – If you are new to WinRunner or to testing, you may want to consider working in the GUI Map File per Test mode. This is the simplest mode for inexperienced testers and for ensuring that updated GUI map files are saved and loaded.
– For example, when WinRunner looks at an OK button, it might recognize that the button is located in an Open window, belongs to the push_button object class, and has the text label OK.
Winrunner 实例演示—订一张飞机票
飞机票订票系统演示 1)Login: name/password: Agent/Mercury 2) New order: 3) Open order: 4) Cancel order:
5) Search order:
6) Analysis: 7) Help: 8) About: 9) C:\Program Files\Mercury Interactive\WinRunner\samples\flight\tests\instords
• Refer to Lesson 3
ONLY FOR SJCU Presentation
流程 1. Create GUI Map –理解WR 如何识别GUI组件
• 每个GUI组件都有一组属性,在context sensitive模式下, WinRunner learns these properties and uses them to identify and locate GUI objects during a test run. Note that in Context Sensitive mode, WinRunner does not need to know the physical location of a GUI object to identify it.
ONLY FOR SJCU Presentation
流程 4. Run Tests 演示–执行单个、多个脚本
Refer to Lesson batch
ONLY FOR SJCU Presentation
流程 5. View Results
• 当测试任务结束后,系统会自动生成测试结果报告,测试结果报告显示了每个 测试脚本运行情况,并记录了运行期间的发生的主要事情,例如检查点检测情 况、错误信息等。 • 当测试点测试出不匹配现象,测试结果报告中会显示出预期结果和实际结果。
– 1、通过自动代替手工测试,缩短测试时间 、避免人为错误。 – 2、通过在升级应用程序时修改和重用测试脚本,尽量提高投资回报(ROI) • 不足 – 1.脚本维护需要成本 – 2.自动化一般达不到100%
ONLY FOR SJCU Presentation
Winrunner 简介-界面
ONLY FOR SJCU Presentation
Refer to Lesson 3
ONLY FOR SJCU Presentation
流程 2. Create Tests演示–录制、修改一个脚本
Refer to Lesson 3
ONLY FOR SJCU Presentation
流程 3. Debug Tests
• 脚本也是程序,需要纠错,来保证测试任务顺利完成。通过设置程序断点,监 控变量来排查脚本中的语法错误和逻辑错误。
ONLY FOR SJCU Presentation
流程 1. Create GUI Map –理解WR 如何识别GUI组件
ONLY FOR SJCU Presentation
流程 1. Create GUI Map – GUI Map Mode
• The GUI Map File per Test Mode