Thursday, February 7, 2013

QTP unables to identify pop up window


There are couple of scenarios where we perform some operations in a application, where a pop up window will appear like:
1. When you delete a user/emp, it will display a pop up saying "Do you want to Delete the user?"
2. You choose some pop up menu option, then a pop up window may be displayed with the selected items functionality.

For sometimes, even though you have the correct recorded script, it may throw you an error saying the object does not exist.

Ex: B("XYZ").Dialog("Delete User").WinButton("Ok").click    may throw error saying "Object not visible".

How to overcome this error?

Cause: The "visible" property of the Parent object may not enabled.

Solution: Goto Tools -> Object Identification -> Choose Environment type -> Choose the object class(in our case Browser is the parent to the Dialog box) -> Click on Add/Remove property -> select "visible" property.
After visibility property is configured, now re-record the steps.

Now QTP should be able to identify the pop up window.

Tuesday, February 5, 2013

How to get QTP Results in a HTML file

Once we ran our Regression suite, it is handy if the results are displayed in HTML File, it is easy for us to understand at the same time also easy for the management(Lead/Manager/Customer) to look at it.

They will not show any interest if you zip your QTP Result folders and send it to them.

And for many reasons it is handy if the results are displayed in HTML File, right? How can we get the results in HTML File.

But how can we view results in HTML File?

By changing one registry setting, we have get QTP results in a HTML File.

Open windows registry by entering regedit and clicking enter in Windows run.

HKLM\Software\MercuryInteractive\QuickTestProfessional\Logger\Media\Log

Double click on "Active"

Change the value from 0 to 1.

Restart QTP.

Now run your QTP Test and see results in the QTP Test folder, where you see a "Log" folder.

In this folder you will see a file called LogFile.html which is the HTML Report.

Friday, February 1, 2013

How to check the website you are testing is up and running

We can check the website up and running by just pinging the website.

You can do that in couple of ways.

Here is the simplest way to  ping a website.

Appraoch1:

strWebSiteName="www.yahoo.com"
strQuery = "SELECT * FROM Win32_PingStatus WHERE Address = '" & strWebSiteName & "'"
bFlag = False

Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set objItems = objWMIService.ExecQuery( strQuery )

For Each objItem In objItems
       If objItem.StatusCode = 0 Then
            bFlag = True
            Exit For
        Else
            bFlag = False
        End If
Next

If bFlag = true Then
    print "Website is avilable"
else
    print "Website not avilable"
End If

Set objItems = Nothing
Set objWMIService = Nothing

Appraoch2:
Set oNetwork = DotNetFactory( "Microsoft.VisualBasic.Devices.Network" ,"Microsoft.VisualBasic")
bFlag=oNetwork.ping(strWebSiteName)
If bFlag Then
  print  "Website is avilable"
Else
   print  "Website not avilable"
End If
Set oNetwork=nothing