My Blog List

Friday, January 13, 2012

QTP Rare Tips - I

1. Prevent machine locking while script execution in QTP
  1. Set deviceReplay = CreateObject("Mercury.DeviceReplay")
  2. deviceReplay.MouseMove 0,0  //OR abs_x + 10, abs_y + 10
  3. deviceReplay.PressKey 28 //optional
  4. Set deviceReplay = Nothing
Also used this object, we can perform Mouse/Keyboard operations if Set/Type not supported in QTP. Refer this.

2. Produce HTML log
    a. Close the QTP.
    b. Modify the below key value by opening Registry Editor in your machine.
        HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\Logger\Media\Log
    c. Change DWord Active value as 1 insteadof 0.
    d. Now open QTP and execute your scripts. You will find a new folder Log under your results folder.
    e. You can use the HTML log present under Log folder to send via mail to anybody.

3. Disable unwanted log events from your log.
You can use Reporter.Filter to restrict default events on log. You can use Filter property to log the events which are logged by yourself using Reporter.ReportEvent and want to  avoid entries which are logged by QTP itself like below,
  1. Reporter.Filter = rfEnableAll   'Enables all type of logging
  2. Reporter.ReportEvent micPass, "Step1", "opened my page"
  3. Reporter.Filter = rfDisableAll    'Disables all type of logging

4. DescribeResult(Err.Number)
DescribeResult(Err.Number) in QTP - Just displays Err.Description value

No comments:

Post a Comment