• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 專注于軟件測試理論+實踐,自動化測試(功能、性能),希望廣交天下愛好測試的朋友,積極加入我的圈圈!測試者家園期待您的加入!

    一段Winrunner的樣例腳本

    上一篇 / 下一篇  2007-06-27 14:28:54

    #########################################################################################################
    #
    # Test Name     : Date Boundary
    # Subject          : Open Order Form
    #
    # Description    : Checks that the input of illegal values in the Flight Date is blocked and that error messages
    #    appear.  The following input should be tested:
    #     1. Flight Date Edit field is disabled when button is unchecked
    #     2. Characters (not accepted)
    #     3. More than six numbers (not accepted)
    #     4. Less than six numbers (OK is disabled)
    #     5. Invalid Month
    #     6. Invalid date of the month
    #     7. No entry
    #
    #
    #########################################################################################################

    #static variables:
    static ret_val,date_str,i;
    # Constant declaration
    static const DISABLED = FALSE;

    # Variable declaration.  Can be anything the user wants.
    static date_string_of_chars  = "as/cd/ef";     # Used in STEP 2.  Characters (Not accepted).
    static date_seven_numbers = "12/34/567"; # Used in STEP 3.  More than six numbers not accepted.
    static date_invalid_month    = "13/20/95";   # Used in STEP 5.  Invalid month.
    static date_invalid_day        = "12/32/95";   # Used in STEP 6.  Invalid date of month.

    static lib_path = getvar("testname") & "\\..\\flt_lib";

    # Static function reinitialize ().  Reinitializes Flight Date to OFF and clears the edit field.
    static function reinitialize ()
    {
     auto ret_val;
     set_window ("Open Order");
     obj_get_info ("FlightDateEdit", "enabled", ret_val);
     if (ret_val == TRUE) {
         set_window ("Open Order");
      edit_set_insert_pos ("FlightDateEdit", 0, 0);
      type ("");
     }
    }

    # Static function insert_date ().  Inserts the date into the FlightDateEdit field.
    static function insert_date (in date)
    {
     set_window ("Open Order");
     edit_set_insert_pos("FlightDateEdit",0,0);
     type(date);
    }

    reload(lib_path);

    # Open the flight application
    rc = open_flight();
    if (rc == E_GENERAL_ERROR){
      tl_step(initialization, FAIL,couldnt_open_flight);
     clean_up();
     texit;
    }

     

    # Initialization.
    open_OpenOrderForm. ();


    # STEP 1.  Flight Date Edit is disabled

    set_window ("Open Order");

    # Checking to see if the edit field is disabled when button is unchecked
    obj_get_info ("FlightDateEdit", "enabled", ret_val);
    if (ret_val == DISABLED)
     tl_step (disabled, PASS, flight_date_disabled);
    else
     tl_step (disabled, FAIL, flight_date_not_disabled);
    reinitialize ();


    # STEP 2.  Characters (not accepted)

    button_set ("Flight Date", ON);

    # Inserting a date of characters using variable, "date_string_of_chars", defined above.
    insert_date (date_string_of_chars);
    edit_get_text ("FlightDateEdit", date_str);

    # Checking to see if application handled illegal open order procedure
    if (date_str == "__/__/__")
     tl_step (characters, PASS, chars_not_accepted);
    else
     tl_step (characters, FAIL, chars_accepted);
    reinitialize ();

    # STEP 3. More than six numbers (not accepted)

    button_set ("Flight Date", ON);
    # Inserting a date consisting of more than six numbers using variable, "date_seven_numbers", defined above.
    insert_date (date_seven_numbers);
    edit_get_text ("FlightDateEdit", date_str);

    # Checking to see if application handled illegal open order procedure
    if (date_str == "12/34/56")
     tl_step(more_than_six, PASS, more_than_six_not_accepted);
    else
     tl_step(more_than_six, FAIL, more_than_six_accepted);
    reinitialize ();

    # STEP 4. Less than six numbers (OK is disabled)

    edit_set_insert_pos ("FlightDateEdit", 0, 0);

    # Using for_loop to systematically check if OK button is disabled for any date with less than six numbers in it
    for (i = 1; i <= 6; i++) {
     type(i);
     if (button_check_enabled ("OK", TRUE) == E_OK)
      break;

    }

    #  The actual check to make sure that OK was disabled for date less than six numbers
    ts_msg = sprintf(ok_not_disabled, i);
    if (i < 6)
     tl_step (less_than_six, FAIL, ts_msg);
    else
     tl_step (less_than_six, PASS, ok_disabled);
    reinitialize ();

    # STEP 5. Invalid Month

    set_window ("Open Order");
    # Inserting a date with an invalid month using variable, "date_invalid_month", defined above.
    insert_date (date_invalid_month);

    # Checking to verify that unless there is a valid month, an error message will pop up when trying to press "OK"
    set_window("Open Order");
    button_press("OK");
    if(win_exists("Flight Reservation Message",10) != E_OK){
     tl_step (invalid_month, FAIL, invalid_month_msg_popup);
     clear_main_window();
     open_OpenOrderForm. ();
    }
    else{
     set_window("Flight Reservation Message");
     static_get_text("Message", txt);
     if(txt !=invalid_month_entered_msg)
      tl_step (invalid_month, FAIL, invalid_month_wrong_msg);
     else
      tl_step (invalid_month, PASS, invalid_month_correct_msg);
     button_press("OK");
    }
    reinitialize ();


    # STEP 6.  Invalid day of month.

    set_window ("Open Order");
    # Inserting a date with an invalid day using variable, "date_invalid_day", defined above.
    insert_date (date_invalid_day);

    # Checking to verify that unless there is a valid day of the month the "OK" button will be disabled
    set_window("Open Order");
    button_press("OK");
    if(win_exists("Flight Reservation Message",10) != E_OK){
     tl_step (invalid_day, FAIL, invalid_day_no_err_msg);
     clear_main_window();
     open_OpenOrderForm. ();
    }
    else{
     set_window("Flight Reservation Message");
     static_get_text("Message", txt);
     if(txt !=invalid_day_entered_msg)
      tl_step (invalid_day, FAIL, invalid_day_wrong_err_msg);
     else
      tl_step (invalid_day, PASS, invalid_day_not_accepted);
     button_press("OK");
    }
    reinitialize ();


    # STEP 7.  No Entry.

    set_window ("Open Order");
    # Inserting no date to see if OK is disabled.
    insert_date ("__/__/__");

    # Checking to see if OK is disabled without any date set in edit field
    if (button_check_enabled ("OK", TRUE) != E_OK)
     tl_step (no_entry, PASS, ok_button_disabled);
    else
     tl_step (no_entry, FAIL, ok_button_enabled);


    # Returning to initial state.
    button_press ("Cancel");
    clean_up();


    # End of test.



    測試者家園 2006-12-08 09:24 發表評論


    Link URL: http://www.cnblogs.com/tester2test/archive/2006/12/08/586031.html

    TAG:

     

    評分:0

    我來說兩句

    顯示全部

    :loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

    日歷

    « 2011-03-27  
      12345
    6789101112
    13141516171819
    20212223242526
    2728293031  

    數據統計

    • 訪問量: 8895
    • 日志數: 150
    • 建立時間: 2007-04-23
    • 更新時間: 2007-06-21

    RSS訂閱

    Open Toolbar
    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>