xiaoqingyu 发表于 2005-12-12 18:04:29

请教关于winrunner问题

在winrunner自带的Flight 4A 中我进行定票,然后判断总票价是否等于单票价乘以票数,发现总票价老是等于0,不知道为什么:


Flight Reservation
        win_activate ("Flight Reservation");
        set_window ("Flight Reservation", 1);
        obj_type ("MSMaskWndClass","122005");
       


        list_select_item ("Fly From:", "Frankfurt");# Item Number 1;
       
        list_select_item ("Fly To:", "Paris");# Item Number 3;
       
        obj_mouse_click ("FLIGHT", 38, 32, LEFT);
       
        edit_get_text("Flight No:",number);
        report_msg(number & "is flight no");



# Flights Table
        set_window ("Flights Table", 1);
        button_press ("OK");

# Flight Reservation
        set_window ("Flight Reservation", 4);
        edit_set ("Name:", "first");
        edit_set ("Tickets:", "2");
       
        edit_get_text("Name:",name);
        edit_get_text("Tickets:",tick);
        report_msg(name);
        report_msg(tick);

       
       
        button_set ("Business", ON);
        button_press ("Insert Order");
        obj_wait_bitmap("Insert Order", "Img6", 15);
        edit_get_text("Order No:",order);
        report_msg(order);

# Flight Reservation
        win_activate ("Flight Reservation");
        set_window ("Flight Reservation", 2);
        menu_select_item ("File;Open Order...");

# Open Order
        set_window ("Open Order", 1);
        button_set ("Order No.", ON);
        edit_set ("Edit_1", ""order"");
        button_press ("OK");
       
# Flight Reservation
        set_window ("Flight Reservation", 2);
        obj_mouse_click ("#32770", 410, 256, LEFT);
        obj_mouse_click ("#32770", 398, 284, LEFT);
        edit_get_text("Tickets:",tickets);
    edit_get_text("Price:",price);
    edit_get_text("Total:",total);
       
        report_msg("票数是"&tickets);
        report_msg("单票价钱是:"&price);
        report_msg("总票价是:"&total);
       
        result = tickets * price ;
        report_msg("最后票价是:"&result);#对于result的值我这里总是显示为0,不知道为什么?
       
        if(total == tickets * price)
        tl_step("total",0,"is correct");
        else
        tl_step("total",1,"isnot correct");

aswoon911 发表于 2005-12-13 10:57:17

楼上的,计算前记得去掉单价前的"$".如何去掉的方法请查阅WR的字符串相关函数.
页: [1]
查看完整版本: 请教关于winrunner问题