51Testing软件测试论坛

标题: 我怎么总是碰上怪问题? [打印本页]

作者: lbdfg    时间: 2005-4-30 17:52
标题: 我怎么总是碰上怪问题?
# Shell_TrayWnd
#        set_window ("Shell_TrayWnd", 4);
#        toolbar_button_press ("ToolbarWindow32_1", "Flight Reservation"); # Button Number 2;

# Flight Reservation
        set_window ("Flight Reservation", 6);
        menu_select_item ("Analysis;Graphs...");

# Graph
        set_window("Graph", 10);
        obj_get_text("GS_Drawing", first, 226, 210, 241, 225);        #  34
        tl_step("print",0,first);


# Shell_TrayWnd
        set_window ("Shell_TrayWnd", 5);
        toolbar_button_press ("ToolbarWindow32_1", "Flight Reservation"); # Button Number 2;

# Graph
        win_close ("Graph");

# Flight Reservation
        set_window ("Flight Reservation", 3);
        menu_select_item ("File;New Order");
        obj_type ("MSMaskWndClass","01<kBackSpace>50105");
        list_select_item ("Fly From:", "Denver");  # Item Number 0;
        list_select_item ("Fly To:", "London");  # Item Number 1;
        obj_mouse_click ("FLIGHT", 16, 33, LEFT);

# Flights Table
        set_window ("Flights Table", 2);
        list_activate_item ("Flight", "20261   DEN   09:12 AM   LON   04:23 PM   AA     $112.20"); # Item Number 1;

# Flight Reservation
        set_window ("Flight Reservation", 7);
        edit_set ("Name:", "tt");
        button_set ("First", ON);
        button_press ("Insert Order");

# Shell_TrayWnd
        set_window ("Shell_TrayWnd", 39);
        toolbar_button_press ("ToolbarWindow32_1", "Flight Reservation"); # Button Number 2;

# Flight Reservation
        set_window ("Flight Reservation", 9);
        obj_wait_bitmap("Insert Done...", "Img3", 1);
        menu_select_item ("Analysis;Graphs...");

# Graph
        set_window("Graph", 8);
        obj_get_text("GS_Drawing", new, 228, 209, 242, 223);        #  35
        tl_step("print",0,new);
       

# Shell_TrayWnd
        set_window ("Shell_TrayWnd", 11);
        toolbar_button_press ("ToolbarWindow32_1", "Flight Reservation"); # Button Number 2;

# Graph
        win_close ("Graph");
# Check if tickets sold increase 1
       
        if(new == first+1)
                tl_step("total",0,"correct" new "," first);
        else
                tl_step("total",1,"incorrect" new "," first);

从Graph上取text,又是if问题,在进入if时它认为new!=first+1,在显示结果时确又确实显示的new比first大一,怎么回事?怪

[ Last edited by lbdfg on 2005-4-30 at 18:20 ]
作者: pcl2004_27    时间: 2005-5-6 23:39
if(new == first+1)
                tl_step("total",0,"correct" new "," first);
        else
                tl_step("total",1,"incorrect" new "," first);

修改一下脚本:

if(new == (first+1))
                tl_step("total",0,"correct" new "," first);
else
                tl_step("total",1,"incorrect" new "," first);
调试下

调试脚本把变量new和first 在运行过程中打印出来,看看最后结果是什么
然后找原因
作者: lbdfg    时间: 2005-5-9 08:23
哈哈,原来这样啊,明白了




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2