• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: 小 中 大 | 推荐给好友 上一篇 | 下一篇

Test Complete的性能记录方法

发布: 2008-7-03 14:15 | 作者: 不详 | 来源: 51testing | 查看: 248次 | 进入软件测试论坛讨论

领测软件测试网

 
procedure TestAQtime;
var
 p : array[0..2] of OleVariant;
 i, FileName : OleVariant;
begin
 p[0] := slAQtime.P4_AllocationProfiler; // Allocation Profiler
 p[1] := slAQtime.P4_CoverageProfiler; // Coverage Profiler
 p[2] := slAQtime.P4_PerformanceProfiler; // Performance Profiler
 
 // Opens your application in AQtime
 FileName := 'C:\MyProjects\MyApplication\MyApp_exe.aqt';
 slAQtime.SetAQtimeProject(FileName);
 
 for i := 0 to 2 do
 begin
    try
      // Starts profiling in AQtime 4
      slAQtime.RunAQtime4(p[i]);
      { To start profiling in other versions of AQtime,
        use the following methods --
        AQtime 3.x:
        slAQtime.RunAQtime3(slAQtime.P3_VCLClassProfiler);
        AQtime 2.x:
        slAQtime.RunAQtime2(slAQtime.P2_VCLClassProfiler);
        AQtime .NET Edition 1.2x:
        slAQtime.RunAQtimeNET(slAQtime.PNET_StatisAnalysis); }
    except
      // Posts an exception message to the test log
      Log.Error(ExceptionMessage);
    end;
 
    // Your code goes here...
 
    // Wait until the profiling is over
    // (we call RunAQtime4 method in a loop)
    slAQtime.DoWaitFinish;
 end;
end;
 
通过调用操作系统的Perfmon对各种性能参数进行监控
        Perfmon是操作系统自带的性能监控工具,它能通过添加各种计数器,对各种性能参数进行记录。在TC中通过调用命令行的方式启动和停止Perfmon。具体方法如下:
        首先在Perfmon中加名为perf_log的计数器日志,这里需要记录的是记事本的相关资源使用情况:
Process(NotePad): % Processor Time、Elapsed Time、Working Set
        然后在TestComplete中调用命令行方式操作Perfmon(注意Perfmon的命令行工具叫logman),通过设定logman的命令行运行参数来启动(start perf_log)和停止(stop perf_log)Perfmon的计数器日志。
 
   //开始记录
   TestedApps.logman.Params.SimpleParams.CommandLineParameters:='start perf_log';
   TestedApps.logman.Run();
  
   //添加你的操作
  
   //结束记录
   TestedApps.logman.Params.SimpleParams.CommandLineParameters:='stop perf_log';
   TestedApps.logman.Run();

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/

43/4<1234>