Wednesday, 14 January 2015

Qtp sample Script:

Qtp sample Script:

Option Explicit
On Error Resume Next
Dim fileObj,filePtrObj,filePtrObj1,actTxt
Set fileObj=CreateObject("Scripting.FileSystemObject")
Set filePtrObj=fileObj.OpenTextFile("D:\sreekar\test data\faxorders.txt",1,True)
Set filePtrObj1=fileObj.OpenTextFile("D:\sreekar\test
data\faxordersresults.txt",2,True)
While filePtrObj.AtEndOfLine<>"True"
        actTxt=filePtrObj.ReadLine
        actTxt=Split(actTxt," ")
        Window("Flight Reservation").Activate
        Window("Flight Reservation").WinMenu("Menu").Select "File;Open Order..."
        If Window("Flight Reservation").Dialog("Open Order").Exist Then
                Window("Flight Reservation").Dialog("Open Order").Activate
                Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order
No.").Set "ON"
                Window("Flight Reservation").Dialog("Open
Order").WinEdit("Edit_2").Set actTxt(3)
                Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
                If Window("Flight Reservation").Dialog("Open Order").Dialog("Flight
Reservations").Exist(2) Then
                        Window("Flight Reservation").Dialog("Open Order").Dialog("Flight
Reservations").WinButton("OK").Click
                        Window("Flight Reservation").Dialog("Open Order").WinButton("Cancel").Click
                        filePtrObj1.WriteLine actTxt(3)&"   order is not found and hence
unable to sent a fax"
                Else
                        Window("Flight Reservation").WinMenu("Menu").Select "File;Fax Order..."
                        If Window("Flight Reservation").Dialog("Fax Order No. 1").Exist Then
                                Window("Flight Reservation").Dialog("Fax Order No.
1").ActiveX("MaskEdBox").Type actTxt(8)
                                Window("Flight Reservation").Dialog("Fax Order No.
1").WinButton("Send").Click
                                If Window("Flight Reservation").Dialog("Fax Order No.
1").Dialog("Flight Reservations").Exist(2) Then
                                        filePtrObj1.WriteLine actTxt(8)&"  fax number is invalid and
hence unable to send a fax for order "&actTxt(3)
                                        Window("Flight Reservation").Dialog("Fax Order No.
1").Dialog("Flight Reservations").WinButton("OK").Click
                                        Window("Flight Reservation").Dialog("Fax Order No.
1").WinButton("Cancel").Click
                                Else
                                        faxDlgExist=Window("Flight Reservation").Dialog("Fax Order No. 1").Exist
                                        While faxDlgExist="True"
                                                faxDlgExist=Window("Flight Reservation").Dialog("Fax Order No.
1").Exist(2)
                                        Wend
                                        faxMsg=Window("Flight Reservation").ActiveX("Threed Panel
Control").GetROProperty("Text")
                                        If faxMsg="Fax Sent Successfully..." Then
                                                filePtrObj1.WriteLine "Fax Sent successfully for the order "&actTxt(3)
                                        Else
                                                filePtrObj1.WriteLine "Fax not Sent successfully for the order "&actTxt(3)
                                        End If
                                End If
                        End If
                End If
        End If

Wend
'killing user defined objects
Set filePtrObj1=Nothing
Set filePtrObj=Nothing
Set fileObj=Nothing

VBScript Variable



VBScript Variable

In VBScript all variables are of the type variant that can store any type of value.

The name of a variable in VBScript must begin with a letter and it cannot contain
period (.) and its maximum length can be of 255 characters.

Saturday, 10 January 2015

check points in qtp



Check Point:
It is a validation point to check the object state or bitmap state or data state during the execution at any point of time.
Check Point Process during Recording
  1. Captures the expected value
  2. Generates the respective script statement
Check Point Process during Running
  1. Captures the actual value from the AUT
  2. Compares the Expected value with the Actual Value
  3. Displays the results

Friday, 9 January 2015

Difference between different QTP versions ( 9.2, 9.5, 10.0)

Difference between different QTP versions ( 9.2, 9.5, 10.0)
Between QTP 9.5 & earlier versions

1. Checkpoints and Output values can be seen & edited in the OR while same was not possible in the earlier
 versions of QTP.
2. Installation file is a single one bundled with all add-ins, previously we have to download add-ins
separately.
3. Movie recorder was introduced in the results
4. Web add-in extensibility add- in was introduced
5. Maintenance run mode was introduced
6. It also supports the 64 bit windows edition while the earlier were supporting only 32 bit systems only
7. Bitmap tolerance feature was introduced in QTP 9.5

Between QTP 10.0 & Earlier versions
1. Delphi add-in extensibility is introduced
2. System performance parameters can be monitored
3. COM objects for the Bitmap checkpoints has been introduced
4. Complete UI changes
5. Version control with the help of QC 10.0
6. To Do pane
7. Call actions dynamically
8. From QTP results we can directly go on to the script lines
9. All test resources can be save on one go from QC

Tuesday, 6 January 2015

VB Script in QTP



VB Script in QTP


Scripting language for QuickTest Professional (QTP) is VBScript.


VBScript (short for Visual Basic Scripting Edition) is a lively scripting language
interpreted via Microsoft's Windows Script Host.


VBScript has many powerful functions and provides excellent support for variables,
data types, and error handling.


Two script engines can interpret VBScript- VBScript.dll, which is invoked by asp.dll
is used in web environment and Wscript.exe & Cscript.exe in Windows
GUI environment using Windows script Host (WSH, We typically use VBScript within
WSH to automate systems administration tasks. WSH is the system module that
transforms a VBScript file into a Windows executable file).

Wscript.exe is used to display output and receive input in Windows GUI format such
as dialog and input boxes. Cscript.exe is used in a command-line environment. When
VBScript source code is contained in stand-alone files, they have the file extension
.vbs.