51Testing软件测试论坛

标题: 参数化后运行,跳出录制的程序。但马上转到TestManager,日志信息为Warning [打印本页]

作者: yunshangcao    时间: 2009-3-1 14:56
标题: 参数化后运行,跳出录制的程序。但马上转到TestManager,日志信息为Warning
版本: Rational RobotV7.0(从verycd.com上下的)
所测程序:QTP的飞机订票系统

录制好后回放成功,但参数化后运行,跳出录制的程序。接着马上转到TestManager,日志信息为Warning
右击playback warning信息,显示:“Unhandled Exception detected during playback. Robot stopped playing back”。

在IBM的官网上查到如下信息,但据它所说的是sqadatapoolclose()的问题,并不如此。
  
Error: Unhandled exception detected during playback. Robot stopped playing back
  
Technote (troubleshooting)
  
Problem(Abstract)
This technote explains how to resolve an unhandled exception that might occur when running IBM® Rational® Robot script with a TestManager datapool.  
  
Symptom
Robot script with a TestManager datapool runs for a second, then TestManager log brings up the following error:


Unhandled exception detected during playback. Robot stopped playing back  
  



Cause
Datapool corruption is one common root cause of this exception. However, other playback scenarios might also produce the same error message.  
  

Resolving the problem
To resolve this error, ensure SQADatapoolClose() is called whenever SQADatapoolOpen() is used in Robot scripts. Specifically each SQADatapoolOpen() call must be followed by SQADatapoolClose(). This would proven Datapool corruption and this unhandled exception. Please contact IBM® Rational Support if there are questions.

录制编写的程序脚本如下:

'$include "sqautil.sbh"
Sub Main
    Dim Result As Integer
    dim i as integer
    dim dp as long
    dim uname as string
    dim num as string

    'Initially Recorded: 2009-3-1  13:49:02
    'Script Name: t3
    for i=1 to 3
    StartApplication """C:\Disk_I\ForWork\Mercury\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"""
    dp=SQADatapoolOpen("1")
    call SQADatapoolFetch(dp)
    call SQADatapoolValue(dp,1,uname)
    call SQADatapoolValue(dp,2,num)
    call SQADatapoolClose(dp)
    Window SetContext, "Caption=Login", ""
    InputKeys uname
    EditBox Click, "ObjectIndex=2", "Coords=9,9"
    InputEncKeys "CAAAAM4AAAAICaEYwet4JA=="
    PushButton Click, "Text=OK"
   
    Window SetContext, "Caption=Flight Reservation", ""
    InputKeys "101010"
    ComboBox Click, "ObjectIndex=1", "Coords=99,9"
    ComboListBox Click, "ObjectIndex=1", "Text=Los Angeles"
    ComboBox Click, "ObjectIndex=2", "Coords=89,4"
    ComboListBox Click, "ObjectIndex=2", "Text=Seattle"
    PushButton Click, "Text=FLIGHT"
   
    Window SetContext, "Caption=Flights Table", ""
    PushButton Click, "Text=OK"
   
    Window SetContext, "Caption=Flight Reservation", ""
    InputKeys "syy"
    RadioButton Click, "Text=First"
    EditBox Left_Drag, "ObjectIndex=2", "Coords=13,12,-23,9"
    InputKeys num
    PushButton Click, "Text=Insert Order"
    'call sqadatapoolclose(dp)
    Window CloseWin, "", ""
   
    next

End Sub


或许是破解的问题,盼请高手予以指点

附截图:
作者: andychen911    时间: 2009-3-3 12:24
标题: 回复一个我录制的,供参考
'$Include "sqautil.sbh"
Sub Main
    Dim Result As Integer

    dim username as string
    dim password as string
    dim i as integer
    dim dp as long
   
   
    'Initially Recorded: 2009-3-2  15:08:53
    'Script Name: sample
    startapplication "D:\Program Files\qtp\samples\flight\app\flight4a.exe"
   
    dp=SQADatapoolOpen("login")
   
    for i= 1 to 2
    call SQADatapoolFetch(dp)
    call SQADatapoolValue(dp,1,username)
    'CallScript "test2"
    call SQADatapoolValue(dp,1,password)
    SQAConsoleWrite "username is :"&username
    SQAConsoleWrite "password is :"&password
    Window SetContext, "Caption=Login", ""
    InputKeys username
    EditBox Click, "ObjectIndex=2", "Coords=26,2"
    InputKeys password
    PushButton Click, "Text=OK"
   
    Result = PushButtonVP(CompareText, "Text=OK", "VP=Alphanumeric;Type=CaseInsensitive")
   
    Window SetTestContext, "Caption=Login", ""
   
    Window ResetTestContext, "", ""
   
   
   
   
    Window SetContext, "Caption=Flight Reservations", ""
    Result=SQAWaitForPropertyvalue("Text=确定","Enabled",True,2000)
   
    if Result<>sqaSuccess then
       SQAConsoleWrite "确定按钮没有出现"
      
       Window SetContext, "Caption=Flight Reservation", ""
       Window CloseWin, "", ""

    else
   
       SQAConsoleWrite "确定按钮出现"
       PushButton Click,"Text=确定"
       Window SetContext, "Caption=Login", ""
       EditBox Click, "ObjectIndex=1", "Coords=47,6"
       InputKeys "{BKSP}{BKSP}{BKSP}{BKSP}{BKSP}{BKSP}{BKSP}{BKSP}"
    end if
            
    next
    Call SQADatapoolClose(dp)
End Sub




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2