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

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

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    Test Complete的性能記錄方法

    發布: 2009-3-12 09:01 | 作者: 不詳 | 來源: 測試時代采編 | 查看: 227次 | 進入軟件測試論壇討論

    領測軟件測試網

      Test Complete主要是一個功能測試工具,利用其對GUI控件的識別、動作記錄、回放等腳本技術實現替代部分的人工測試的執行。但是它同時還提供很多機制讓我們在功能測試的同時記錄性能。  

     MemUsage,CPUUsage        

    可利用TC(Test Complete)的sys對象的屬性獲得關于進程和操作系統的內存、CPU使用情況。          

    下面腳本記錄當前所有進程和操作系統使用的內存:   

    log.Message(VarToStr(Sys.MemUsage)+'%');           

    下面腳本記錄notepad進程的當前內存使用情況:   

    Log.Message(VarToStr(Sys.Process('notepad').MemUsage)+'K');             

    通過訪問Sys對象,可以獲取關于CPU的各種信息,

    例如,CPU處理器、處理器個數、CPU使用率(包括系統的和某個具體進程的)    //Information on the processor(s) installed on the current computer.    log.Message( Sys.CPU);    //Returns the number of processors installed on the current computer.    log.Message( Sys.CPUCount);    //Current percentage of CPU time used by the operating system and all running processes.    log.Message( VarToStr(Sys.CPUUsage)+'%');       //the current approximate percentage of the CPU time spent running the process.    log.Message( VarToStr(Sys.Process('notepad').CPUUsage)+'%');            

     注意:使用TC提供的VarToStr函數把Sys對象的各種屬性變量值轉換成String類型,否則log信息無法顯示值。   與AQTime集成         上面說的方法是TC本身提供的,只能記錄基本的性能參數,例如內存、CPU,TC還提供另外的途徑記錄性能,例如通過與AQTime集成的方式,AQTime是AutomatedQA公司出品的代碼性能測試工具,它能在程序執行過程中記錄每行代碼的執行效率,內存使用情況、代碼覆蓋率等。          

    與AQTime集成有兩種方式。一種是調用AQTime軟件的方式,另外一種是直接使用AQTime提供的接口對象。          

    如果采用第一種方式,則首先應該把TC的TestedApps的執行模式改成 Profile 模式,可在TestedApps editor中設置,也可在腳本中設置,

    例如:   var  MyApp : OleVariant; begin  // Obtains the tested application  MyApp := TestedApps.MyTestedApp;    // Specifies the run mode parameters  MyApp.Params.ProfileParams.AQtimeVersion := 5;  MyApp.Params.ProfileParams.ProfilerName := 'Coverage Profiler';  MyApp.Params.ProfileParams.RunMode := 'Normal';  MyApp.Params.ProfileParams.UseProject := False;    // Activates the Profile run mode  MyApp.Params.ProfileParams.Activate;  ... end;          

    第二種方式是采用訪問提供的編程對象的方式,提供AQtimeIntegration 、AQtime、slAQtime對象來訪問AQTime的各種功能。          

    例如,下面腳本使用AQtimeIntegration 和AQtime對象,首先通過AqtimeIntegration對象的IsSupportedVersionAvailable屬性判斷某版本的AQTime是否存在,如果存在,則指定CurrentVersion為某版本的AQTime,然后通過AQTime對象的CreateProjectFromModule方法創建一個新的AQTime項目,通過SelectProfiler方法指定Profile的類型,通過StartProfiling方法開始Profile,通過WaitAndExportResults輸出結果。  

    procedure TestAQtime; begin  // Checks AQtime version  if not AQtimeIntegration.IsSupportedVersionAvailable('4') then  begin     Log.Error('The required version of AQtime is not installed.');    

    Exit;  end;  

      // Specifies the desired AQtime version  AQtimeIntegration.CurrentVersion := 4;  

     // Creates a new project  if not AQtime.CreateProjectFromModule('C:\MyTestedApp\MyTestedApp.exe') then  begin    

    Log.Error('Cannot open the project.');     Exit;  end;    // Selects the desired profiler  if not AQtime.SelectProfiler('Performance Profiler') then  begin    

    Log.Error('Cannot select the specified profiler.');    

     Exit;  end;  

     // Starts profiling  if not AQtime.StartProfiling() then  begin    

    Log.Error('Cannot start profiling.');     Exit;  end;  

     // Waits until the profiling is over and  // exports profiling results  AQtime.WaitAndExportResults('C:\MyTestedApp\MySummaryResults.xml',                             

      'C:\MyTestedApp\MyResults.xml');    // Closes AQtime  AQtime.Close(); end;

    延伸閱讀

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

    TAG: Complete test Test TEST 記錄 性能


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