• <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的問題整理

    發布: 2010-1-19 16:18 | 作者: 網絡轉載 | 來源: 領測軟件測試 | 查看: 65次 | 進入軟件測試論壇討論

    領測軟件測試網

     

    6. 為什么每次對比這兩個文件結果都是通過的。
      答:這個問題的原因在于它在前面的腳本中對文件進行了操作,沒有關閉,所以這段代碼運行總是通過

     7.如何在winRunner中用Windows的API函數
    在使用該API函數前需要先加載該函數然后聲明API函數,代碼如下

    load_dll("user32.dll");
    extern int PostMessageA(in long, in long, in long, in long);
    win_get_info("{class:window, MSW_class:AfxMDIFrame42, label:\"!WinRunner.*\"}", "handle", hWnd);
    PostMessageA(hWnd, 16, 0, 0);
    請在嘗試以上代碼的時候,保存腳本,呵呵!

     8.怎樣處理跟蹤鍵盤操作?
      答:下邊的代碼希望對你有幫助

    function GetKeyStatus(in vKey){
    auto pid, thread_id, win_desc, hWnd, KeyState, win_log_name, win_full_desc, focused_obj_desc;
    win_desc = "{active:1}";
    if (win_exists(win_desc)==0) {
    win_get_desc(win_desc, "", "", "", win_full_desc);
    GUI_map_get_logical_name( win_full_desc, "", win_log_name, "bla");
    win_get_info(win_desc, "handle", hWnd);
    pid = GetWindowThreadProcessId(hWnd, NULL);
    thread_id=GetCurrentThreadId();
    AttachThreadInput(pid,thread_id,TRUE);
    KeyState=GetKeyState (vKey);
    AttachThreadInput(pid,thread_id,FALSE);
    if (KeyState < 0)
    return(0); # Key is pressed
    else
    return (1); # Key is not pressed
    }
    else
    return (-1); # No active window found, so cannot determine key state
    }

     9.WinRunner如何處理excel?
      答:其實解決方法有很多,這里列舉兩種。
      一.利用其他語言特性開發出dll提供給winrunner使用(vb,vc,delphi等)
      二.在其他環境中實現,用winrunner調用
      第一種我在這里不舉例子了,第二種我利用vbs往excel中賦值給大家提供一種思路,代碼如下:

    'vbs中的代碼
    Dim ExcelApp
    Dim itemX
    if Wscrīpt.Arguments.Count < 2 then
    r = msgbox("Requires 2 arguments", 48, "change_sheet")
    else
    dim fso
    set fso = createobject("scrīpting.filesystemobject")
    xlBook = fso.GetAbsolutePathName(Wscrīpt.Arguments(0))
    xlSheet = Wscrīpt.Arguments(1)
    set fso = Nothing
    Set ExcelApp = CreateObject("Excel.Application")
    ExcelApp.Workbooks.Open(xlBook)
    Set itemX = ExcelApp.ActiveWorkbook.Worksheets.Item(xlSheet)
    itemX.Activate

    excelApp.ActiveWorkbook.Worksheets(xlSheet).Range("A1").Select
    excelapp.ActiveCell.FormulaR1C1 = "1"
    excelApp.ActiveWorkbook.Worksheets(xlSheet).Range("B1").Select
    excelapp.ActiveCell.FormulaR1C1 = "2"
    excelApp.ActiveWorkbook.Worksheets(xlSheet).Range("c1").Select
    excelapp.ActiveCell.FormulaR1C1 = "3"

    ExcelApp.ActiveWorkbook.Save()
    ExcelApp.ActiveWorkbook.Close(1)
    ExcelApp.Quit()

    Set itemX = Nothing
    Set ExcelApp = Nothing

    end if

    winrunner中的調用代碼:
    dos_system("wscrīpt \"C:\\excel_sheet.vbs\" \"C:\\SheetBook.xls\" \"Sheet2\"");

     10.在WinRunner中如何實現得到transaction時間?
      答:一般情況下transaction的時間只能在最后結果中得到,如何在腳本得到這個時間呢,下邊的代碼可以

    幫助你:

    public transactions[];
    function start_my_transaction(in transaction_name)
    {
    transactions[transaction_name] = get_time();
    tl_step("Start transaction: \"" & transaction_name & "\"",PASS,"Timestamp: " &

    transactions[transaction_name]);
    return (transactions[transaction_name]);
    }
    function end_my_transaction(in transaction_name)
    {
    auto end_time = get_time();
    auto rc;
    if(transactions[transaction_name] == "")
    {
    tl_step("End transaction: \"" & transaction_name & "\"",FAIL,"Transaction was

    never started.");
    rc = -1;
    }
    else
    tl_step("End transaction: \"" & transaction_name & "\"",PASS,"Elapsed Time: "

    & (rc = end_time - transactions[transaction_name]));
    delete transactions[transaction_name];
    return rc;
    }

    start_my_transaction("my_transaction");
    wait(2);
    rc = end_my_transaction("my_transaction");
    pause("Elapsed time = " & rc);

    文章來源于領測軟件測試網 http://www.kjueaiud.com/

    22/2<12

    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備10010545號-5
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

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