• <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 編碼規范

    發表于:2008-11-04來源:作者:點擊數: 標簽:規范編碼winrunnerWinRunnerWinrunner
    1 路徑不能寫死 從一臺機器拷貝到另一臺機器上之后, WinRunner 的腳本需要能夠正常的運行。 測試腳本 所依賴的所有的東東(gui maps, text files, compiled modules, dll’s)都要和測試腳本有一樣的父級目錄。 例外: 如果確實有需要的話,指向K drive中的

     1 路徑不能寫死

            從一臺機器拷貝到另一臺機器上之后,WinRunner的腳本需要能夠正常的運行。測試腳本所依賴的所有的東東(gui maps, text files, compiled modules, dll’s)都要和測試腳本有一樣的父級目錄。

            例外:

            如果確實有需要的話,指向K drive中的永久文件的路徑可以寫死。(警告:當腳本在不同的機器上運行,讀取存放在K drive中的同樣的文件的時候,有可能會出現問題。)

            錯誤的示范:

                reload("C:\\WR_TESTS\\Aclearcase/" target="_blank" >cceptance_6\\acceptance_functions");

            正確的示范:

                reload(getvar("testname") & "\\..\acceptance_functions");

            2 采用縮進格式增強代碼的可讀性

            錯誤的示范:

             for(counter = count - 24; counter < count - 1; counter++)
            {
            list_get_item("ListBox",counter,item);
            str = str & item & "\r\n";
            }

            正確的示范一:

            for(counter = count - 24; counter < count - 1; counter++)

            {
            list_get_item("ListBox",counter,item);
            str = str & item & "\r\n";
            }

            正確的示范二:

             for(counter = count - 24; counter < count - 1; counter++){
            list_get_item("ListBox",counter,item);
            str = str & item & "\r\n";
            }

            3 盡量避免將測試外部環境的依賴寫死 不要將一些隨著外部測試環境的變化而改變的信息寫死。包括有:安裝目錄、DSN名、數據庫服務器名、數據庫用戶名、數據庫密碼。最好在測試腳本的開始就將這些東東定義為變量,這樣你就沒有必要在環境變化后,在整個腳本中作多次的修改,只要改一個地方就好了。

            錯誤的示范一:

             set_window("SQL Server Login",10);
            edit_set("Login ID:", "sa");
            edit_type("Password:", "password");

            正確的示范一:

            db_username = "sa";
            db_password = "password";

            set_window("SQL Server Login",10);
            edit_set("Login ID:", db_username);
            edit_type("Password:", db_password);

            錯誤的示范二:

             invoke_application("C:\\iAvenue\\Windows\\UAdmin.exe","","c:\\Power_db",SW_SHOW);

            正確的示范二:

            install_dir = "c:\\iAvenue\\Windows";

            invoke_application(install_dir & "\\UAdmin.exe","",getvar("testname") & "\\..\Power_db",SW_SHOW);



    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品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>