winrunner的基本操作

(1),先在Winrunner里建一个脚本(这里以http://www.newtours.demoaut.com的订购飞机票为例)

(2),点击Record开始录制,

for (i=1; i<5; i++)
 
{
# Shell_TrayWnd
 set_window ("Shell_TrayWnd", 3);
 toolbar_button_press ("ToolbarWindow32_0_1", "启动 Internet Explorer 浏览器"); # Button Number 0;

# Browser Main Window
 set_window ("Browser Main Window", 29);
 list_select_item("browser_main_combo_location","http://www.newtours.demoaut.com");

# Welcome: Mercury Tours
 set_window("Welcome: Mercury Tours",11);
 edit_set("userName","pc8");
 obj_type("userName","<kTab>");
 password_edit_set("password","ca7121aa614993e5");
 obj_type("password","<kReturn_E>");
 web_image_click("login", 35, -52);

# Find a Flight: Mercury Tours:
 set_window("Find a Flight: Mercury Tours:",23);
 list_select_item("passCount",i);(把4改成变量i)
 web_image_click("findFlights", 55, 12);

# Select a Flight: Mercury Tours
 set_window("Select a Flight: Mercury Tours",3);
 web_image_click("reserveFlights", 62, 13);
switch (i) {
case"1":
 # Book a Flight: Mercury Tours
 set_window("Book a Flight: Mercury Tours",5);
 edit_set("passFirst0","1");
 edit_set("passLast0","1");
 break;
 
 case"2":
 # Book a Flight: Mercury Tours
 set_window("Book a Flight: Mercury Tours",5);
 edit_set("passFirst0","1");
 edit_set("passLast0","1");
 edit_set("passFirst1","2");
 edit_set("passLast1","2");
 break;
 
    case"3":
 # Book a Flight: Mercury Tours
 set_window("Book a Flight: Mercury Tours",5);
 edit_set("passFirst0","1");
 edit_set("passLast0","1");
 edit_set("passFirst1","2");
 edit_set("passLast1","2");
 edit_set("passLast2","3");
 edit_set("passFirst2","3");
  break;
  
case"4":
# Book a Flight: Mercury Tours
 set_window("Book a Flight: Mercury Tours",5);
 edit_set("passFirst0","1");
 edit_set("passLast0","1");
 edit_set("passFirst1","2");
 edit_set("passLast1","2");
 edit_set("passLast2","3");
 edit_set("passFirst2","3");
 edit_set("passFirst3","4");
 edit_set("passLast3","4");
 edit_set("creditnumber","123456");
 web_image_click("buyFlights", 57, 8);
 break;
 }
# Browser Main Window
 win_close ("Browser Main Window");
}

 

(3)加个for语句的变量,自动往下订购。

for (i=1; i<5; i++)
 
{
# Shell_TrayWnd
 set_window ("Shell_TrayWnd", 3);
 toolbar_button_press ("ToolbarWindow32_0_1", "启动 Internet Explorer 浏览器"); # Button Number 0;

# Browser Main Window
 set_window ("Browser Main Window", 29);
 list_select_item("browser_main_combo_location","http://www.newtours.demoaut.com");

# Welcome: Mercury Tours
 set_window("Welcome: Mercury Tours",11);
 edit_set("userName","pc8");
 obj_type("userName","<kTab>");
 password_edit_set("password","ca7121aa614993e5");
 obj_type("password","<kReturn_E>");
 web_image_click("login", 35, -52);

# Find a Flight: Mercury Tours:
 set_window("Find a Flight: Mercury Tours:",23);
 list_select_item("passCount",i);
 web_image_click("findFlights", 55, 12);

# Select a Flight: Mercury Tours
 set_window("Select a Flight: Mercury Tours",3);
 web_image_click("reserveFlights", 62, 13);

for (j=0; j<i; j++)

{
 # Book a Flight: Mercury Tours
 set_window("Book a Flight: Mercury Tours",5);
 edit_set("passFirst"&j,"1"&j);
 edit_set("passLast"&j,"1"&j);
 edit_set("creditnumber","123456");
 web_image_click("buyFlights", 57, 8);

 }
# Browser Main Window
 win_close ("Browser Main Window");
}

Winrunner 7.0 使用教程,doc版本 WinRunner 7.0 使用教程(中文版) 第二版 Woza 目录 1. 简介......................................................................................................................................................7 1.1 WinRunner测试模式...................................................................................................................7 1.2 WinRunner测试过程...................................................................................................................8 1.3 样本软件....................................................................................................................................10 1.4 使用TestSuite(测试套件)..........................................................................................................11 2. WinRunner使用概述..........................................................................................................................12 2.1 启动WinRunner........................................................................................................................12 2.2 WinRunner主窗口.....................................................................................................................13 2.3 测试窗口....................................................................................................................................14 2.4 加载WinRunner 插件...............................................................................................................15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值