Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1

    QTP executes script slowly

    i hav 3 reusable actions in 3 scripts which does launching google and search with a text from external datatable value. and calling error handling procdure (a .vbs file which took screenshot if error occurs) after each step in action. the datatable codes are placed in .vbs files and loading all .vbs files required through executefile and relative path.

    the same way objects are loaded using relative path and repositories collection obj

    using environment variables to pass values btwn actions and .vbs files.

    m calling the 3 actions from a driver script and if a action fails to execute the next action will start to execut ( error handler terminates the action that cause error).

    in this above framework approach the script execution is very slow most of the time and in normal speed very few times.

    I also gone through previous posts... and implimented .ini .. environment variables practices.. but still the proble
    m exists... pls guide me to improve the script performance.

  2. #2

    Re: QTP executes script slowly

    Hi vikisis,

    Pls try the below if you haven't already attempted to..

    File -> Settings -> Run - Object Sync Timeout (20 -> 2)

    Change the default 20 seconds to 2 / 3 seconds approx (Disable Smart identification and reduce your object sync tomeout from the default 20 seconds to 2 seconds.)




  3. #3

    Re: QTP executes script slowly

    Thanks jeeva.... I already attemped these steps.. but not much of improvement.

    but used "With" statement in places of repeating browser.page.psframe ... it improves the execution speed ... but still QTP takes time on every "With" statement (browser.page.psframe) and then proceeds good on steps within the "With" block.

  4. #4
    Join Date
    Jan 2007
    Pittsburgh, PA

    Re: QTP executes script slowly

    Post your code here, it might help others to resolve the issue.

  5. #5

    Re: QTP executes script slowly

    Found out the problem, its a single line of code that makes QTP execution very slow

    "SystemUtil.Run "taskkill","/F /IM iexplore.exe""

    This kills iexplore process in error handler (in my framework), after this line of statement (as per my framework) QTP will launch another iexplore to continue with other test script execution (very slowly)

    I tried restarting QTP, but no improvement. After restarting the machine (that too not all the times ) the execution is in normal phase.

    Also tried commenting the above statement, the execution speed is normal.

    any other way to kill the ie, without slowing down the QTP performance? ( also contacted hp regarding this)

  6. #6

    Re: QTP executes script slowly

    Can try SystemUtil.CloseProcessByName and see if that runs on better on your setup. I would wrap it in a conditional. First try a simple browser.close and only resort to the process kill as a last resort.

    I had to get creative on one problematic desktop app and just keep sending it a loop of Alt-f4 and Y to close a bunch of windows and confirmation boxes until it didn't exist anymore.

  7. #7

    Re: QTP executes script slowly

    tried using Browser("Creation time:=0).close instead of killing process and close process by name... Still the same problem exits.

    public sub ehCaptureApp(objError, sFunction, iSeverity)

    Dim datestamp
    Dim filename
    datestamp = Now()

    vTestScenario = Environment.Value("TestCaseID") ' Testscenarioid from environment variable

    iErrNumber = objError.Number
    sErrDescription = objError.Description

    Select Case iErrNumber
    ' If there is no error (i.e., error number is 0) then exit the sub
    Case 0
    ' If an error description was passed in, log it.
    If sErrDescription = "" Then
    Exit Sub
    Reporter.ReportEvent iSeverity, sFunction, "Description: " & sErrDescription
    Exit Sub
    End if

    Case 1
    'if error number is 1 then its an user generated error
    sErrDescription = "Verfication failed"

    Case Else
    'Captures screeshot
    sfilename = vTestScenario&"_"&datestamp&".png"
    sfilename = Replace(sfilename,"/","")
    sfilename = Replace(sfilename,":","")
    sfilename = Environment.Value("RelativePath") & "\Reports\ScreenShots\"&sfilename
    Desktop.CaptureBitmap sfilename,true
    Reporter.ReportEvent micDone,"Error_ScreenImage","<<img src='" & sfilename & "'>"

    End Select

    If iSeverity = micWarning Then
    sErrorDesc = "Number = " & iErrNumber & vbcrlf & "Description: " & sErrDescription
    Reporter.ReportEvent iSeverity, sFunction, sErrorDesc
    'writes warning message in result excel file
    utDBWriteValue "Error","WarningDescription", vTestScenario,sErrorDesc
    End If

    ' If the severity is set to fail
    If iSeverity = micFail Then

    sErrorDesc = "Number = " & iErrNumber & vbcrlf & "Description: " & sErrDescription
    Reporter.ReportEvent iSeverity, sFunction, sErrorDesc & vbcrlf & "Bitmap:" & vTestScenario & ".png"

    'Wait 5
    sErrorDesc = sFunction & vbcrlf & sErrorDesc

    'writes value into the result excel file
    utDBWriteValue "Error","ErrorDescription", vTestScenario,sErrorDesc
    utDBWriteValue "Error","URL", vTestScenario,sfilename

    'SystemUtil.Run "taskkill","/F /IM iexplore.exe"
    'SystemUtil.CloseProcessByName "iexplore.exe"

    'To close any left over popup
    While Browser("CreationTime:=0").Dialog("text:=Microsoft Internet Explorer","nativeclass:=#32770").Exist
    Browser("CreationTime:=0").Dialog("text:=Microsoft Internet Explorer","nativeclass:=#32770").Close

    'To close browser
    While Browser("CreationTime:=0").Exist

    'msgbox "Initalize next browser and start next scenario"


    End If

    End sub

    When the script enters the above error handler method with error, it took screen shot and writes log value in the result excel file... finally it exists the Action in execution. So that the script can continue with next action.

    Every time when error triggers and the script exists the current action and proceeds with next action, QTP executes the scripts slowly. Even after restarting the the tool.... but some times after leaving the tool idle or restarting the machine, the tool performance is normal

    Pls check the above code andlet me know which went wrong.

  8. #8

    Re: QTP executes script slowly

    It would be helpful if you mentioned what sort of errors you are encountering. Sounds like a runaway app, but you're just doing a simple google search. I probably wouldn't even implement error handling for that.

    Sounds and looks more like a configuration problem than a code problem.

  9. #9

    Re: QTP executes script slowly

    not getting error... the QTP takes more time to execute every step than usual .. thats the problem.

    and the google thingk is just an example....

  10. #10
    Senior Member
    Join Date
    Aug 2004
    Bloomington, IL

    Re: QTP executes script slowly

    Whats your QTP Version? If QTP 9.X then..
    Uncheck Tools-->Options-->Run-->Save Still images captures
    to result, Save movie to Result options..

    Some times it also decrease the execution speed...



Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 05:47 PM.

Copyright BetaSoft Inc.