日历

« 2008-09-05  
 123456
78910111213
14151617181920
21222324252627
282930    

统计信息

  • 访问量: 69
  • 日志数: 1
  • 建立时间: 2007-05-16
  • 更新时间: 2007-05-16

RSS订阅

我的最新日志

  • WinRunner求助

    2007-5-16

        那位高手看过《实用软件测试-来自硅谷的技术、经验、心得和实例》这本书,是李幸超老师写的。其中用WinRunner对动态网页和窗体软件进行测试的例子我不能运行,不知道是例子有问题,还是我的电脑配置的原因。

        还有就是WinRunner和IE有冲突。当WinRunner打开时,IE就打不开,退出WinRunner,IE就能正常打开。

        在动态网页测试自动化的例子中,web_browser_invoke(IE, "http://www.yahoo.com/");运行这句话时,就打不开IE浏览器。测试也没有办法继续下去。

         在窗体软件测试中,程序如下:

    Memory Status(WinRunner)

    ##############################
    #Function Memory_Status
    ##############################

    function Memory_Status(in app_name)
    {
     #Varible declaration

        auto task_mgr = "C:\\WINDOWS\\system32\\taskmgr.exe";
     auto gui_map = "E:\\毕业设计\\论文结构\\窗口软件测试\\Task_Mgr.gui";
     auto main_win = "Window Task Manager";
     
     auto work_dir = "E:\\Temp";
     auto rc, i, label, column_index, header_value;
     auto CPU_time;
     auto mem_usage;
     auto vm_size;
     auto mem_peak;
     
     #Load GUI file
     GUI_close_all();
     GUI_load(gui_map);
     
     #Start Task Manager if it is not started.
     if(win_exists(main_win) != E_OK)
      invoke_application(task_mgr, "",work_dir, SW_SHOWNORMAL);
     
     #Select times in the listview of Task Manage that you want to monitor.
     set_window(main_win);
     win_activate(main_win);
     tab_select_item("tab","Processes");
     
     win_activate(main_win);
     set_window(main_win, 3);
     
     menu_select_item("View;Select Columns...");
     set_window("Select Columns", 14);
     
     i = 1;
     while(obj_hightlight("{class: check_button, location: "& i &"}",1) == E_OK)
     {
      obj_get_info("{class: check_button,location: "& i &"}","label",label);
      if(label == "CPU Time" || label == "Memory Usage" || label == "Virtual Memory Size")
       button_set(label,ON);
      else
       button_set(label,OFF);
      i++;
     }
     button_press("OK");
     
     #Extract the needed info about the AUT
     set_window(main_win);
     win_activate(main_win);
     tab_select_item("tab","Processes");
     set_window("Processes");
     
     rc = list_select_item("SysListView32","notedpad.exe");
     if(rc == E_ITEM_NOT_FOUND)
     {
      report_msg("Application " &app_name& " is not yet started, exiting.");
      texit;
     }
     else
     {
      column_index = 0;
      while(column_index <= 3)
      {
       list_get_column_header("SysListView32", column_index, header_value);
       if(header_value == "CPU Time")
        list_get_subitem("SysListView32", app_name, column_index, CPU_time);
       if(header_value == "Mem Usage")
        list_get_subitem("SysListView32", app_name, column_index, mem_usage);
       if(header_value == "VM Size")
        list_get_subitem("SysListView32", app_name, column_index, vm_size);
       column_index++;
      }
     }
     
     #Extract Peak Memory Usage from Performance page of the task Manager.
     set_window(main_win);
     win_activate(main_win);
     
     tab_select_item("tab", "Performance");
     set_window("Performance");
     edit_get_text("Peak", mem_peak);
     
     #Reporting
     report_msg("CPU_time = "&CPU_time&" mem_usage = "&mem_usage&" vm_size = "&vm_size&" mem_peak = "&mem_peak);
     
     #Close Task Manager
     #win_close(main_win);
    }

    运行时总是出现

    Syntax error

    function Memory_Status(in app_name)

    我不知道什么原因,那位高手知道的话,敬请不吝赐教。我在这里先谢了。您可以直接给我留言,也可以给我联系。我的QQ:380141032

     

Open Toolbar