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

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

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

    牛人是怎樣用函數實現本地化測試的

    上一篇 / 下一篇  2007-06-20 16:58:51

    通過幾個函數就可以對軟件本地化進行測試,真牛,佩服!




    ############################################################
    # Function:
    #       translate_get_value()
    #
    # Description:
    #       Looks up a given value and gets the translated value.
    #
    # Parameters:
    #       translate_from - What to translate from (column heading 1)
    #       translate_to - What to translate to (column heading 2)
    #       from_value - Value to translated
    #       to_value - Translated value
    #
    # Returns:
    #       0 on success, or standard WinRunner error code on failure.
    #       
    # Syntax:
    #       rc = translate_get_value(in translate_from, in translate_to, in from_value, out to_value);
    #
    # Examples:
    # pause(translate_get_value("English", "Spanish", "Yes", value) &" " & value);
    # pause(translate_get_value("Spanish", "English", "Uno", value) & " " & value);
    ############################################################
    function translate_get_value(in translate_from, in translate_to, in from_value, out to_value)
    {
            auto rc;                       #Used to store the return code
            auto table;            #Used to store the translation table
            auto temp_value;       #Used to read the from_value from translation table
     
            # Set the value for the translation table, and open it
            table = getvar("testname") & "\\default.xls";
            rc = ddt_open (table);
            if (rc != E_OK)
            {
                   to_value = "ERROR: Table could not be opened!";
                   return (rc);
            }
     
            # Check to see if the translate_from is a column in the transation table
            rc=ddt_is_parameter(table, translate_from);
            if (rc!=E_OK)
            {
                   to_value = "ERROR: Invalid column header [" & translate_from & "]!";
                   ddt_close(table);
                   return (rc);
            }
     
            # Check to see if the translation_to is a column in the transation table
            rc=ddt_is_parameter(table, translate_to);
            if (rc!=E_OK)
            {
                   to_value = "ERROR: Invalid column header [" & translate_to & "]!";
                   ddt_close(table);
                   return (rc);
            }
     
            # Assume that the from_value is not found
            to_value = "ERROR: Value is not found [" & from_value & "]!";
            rc = E_STR_NOT_FOUND;
     
            # Search the translation table for the from_value
            do
            {
                   temp_value=ddt_val(table,translate_from);
                   if (temp_value == from_value)
                   {
                           # Return the translated value
                           to_value=ddt_val(table, translate_to);
                           rc = E_OK;                     
                   }
            } while (ddt_next_row(table)==E_OK);
     
            # Close the translation table and exit
            ddt_close(table);
            return (rc);
    }
     
    ############################################################
    # Function:
    #       translate()
    #
    # Description:
    #       Returns the translated value given a lookup value.
    #
    # Parameters:
    #       translate_from - What to translate from (column heading 1)
    #       translate_to - What to translate to (column heading 2)
    #       from_value - Value to translated
    #
    # Returns:
    #       translated value, or empty string on error.
    #       
    # Syntax:
    #       rc = translate(in translate_from, in translate_to, in from_value);
    #
    # Examples:
    # pause(translate("English", "Spanish", "Yes"));
    # pause(translate("Spanish", "English", "Uno"));
    ############################################################
    function translate(in translate_from, in translate_to, in from_value)
    {
            auto to_value;
            auto rc;
     
            rc = translate_get_value(translate_from, translate_to, from_value, to_value);
     
            if (rc == E_OK) 
                   return (to_value);
            else
                   return ("");
    }
            
     


    測試者家園 2006-10-26 12:18 發表評論


    Link URL: http://www.cnblogs.com/tester2test/archive/2006/10/26/540517.html

    TAG:

     

    評分:0

    我來說兩句

    顯示全部

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

    日歷

    « 2011-04-29  
         12
    3456789
    10111213141516
    17181920212223
    24252627282930

    數據統計

    • 訪問量: 8915
    • 日志數: 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>