Sunday, December 9, 2012

Synchronization in QTP



Synchronization : 

                 Synchronization is a process to make the Automation tool(QTP) wait for the application process to complete prior to moving to subsequent steps.
How can we  achieve this,  it can be done in the following ways.
             1. Using Waitproperty method
    2. Browser Navigation timeout.
    3. Object Synchronization timeout
    4. Inserting the  Wait/Exist statement
 *********************************************************************************************
Using Waitproperty method :
*********************************************************************************************
Syntax :
Browser(“Google”).Page(“Google”).WebEdit(“q”).waitproperty(PropName,PropValue,TimeInMilliSeconds)


*********************************************************************************************
 Browser Navigation timeout:
*********************************************************************************************
       Default Browser Navigation timeout is 60 seconds, means if QTP unable identify the Unique browser
object it wait for 60 seconds
*********************************************************************************************
 Increasing the Object Synchronization timeout:
*********************************************************************************************
              Default  object Synchronization timeout is 60 seconds, means if QTP unable identify the Unique object it wait for 60 seconds
*********************************************************************************************
Inserting the  Wait/Exist statement :
*********************************************************************************************
Syntax for wait:
      Wait time in seconds
Syntax for Exist
    Browser(“Google”).Page(“Google”).WebEdit(“q”).exist(5)
****************************************************************************************
Diff : Wait is static and Exist is dynamic
****************************************************************************************





Saturday, December 8, 2012

Working with Excel Object



'****************************************************************************
''To Read The Data From Excel
'****************************************************************************

Set ExcelObj = CreateObject("Excel.Application")
ExcelObj.Workbooks.Open "C:\TestData.xls"
Set WorkSheet = ExcelObj.Sheets.Item(1)
sUserName= WorkSheet .Cells(2,1)
sPasswd = WorkSheet .Cells(2,2)
sKeyWord = WorkSheet .Cells(2,3)
ExcelObj.ActiveWorkbook.Save
ExcelObj.Application.Quit

'****************************************************************************
''To Write the Data into Excel
'****************************************************************************

Set ExcelObj = CreateObject("Excel.Application")
ExcelObj.Workbooks.Open "C:\TestData.xls"
Set WorkSheet = ExcelObj.Sheets.Item(1)
WorkSheet .Cells(i,1) = "Pass"
WorkSheet .Cells(i,2) = "Remarks"
ExcelObj.ActiveWorkbook.Save
ExcelObj.Application.Quit

'****************************************************************************
'To Count the Row & columns
'****************************************************************************

Set ExcelObj = CreateObject("Excel.Application")
ExcelObj.Workbooks.Open "C:\TestData.xls"
Set objUsedRange = ExcelObj.Worksheets(sSheetIndex).UsedRange()
msgbox objUsedRange.rows.Count
msgbox objUsedRange.Columns.Count
ExcelObj.ActiveWorkbook.Save
ExcelObj.Application.Quit

'****************************************************************************
'****************************************************************************

Sunday, October 7, 2012

How delete the cookies,temporary Internet files and browsing history using qtp?

************************************************************
To clear the Cookies
************************************************************
Web applications uses cookies to store user related information. While testing these cookies might interfere with the results of test. It is recommended to delete cookies before starting new test.


  • Using QTP Webutil object  we can delete the cookies
  • Webutil is the undocumented object in the QTP

WebUtil.DeleteCookies()

*******************************************************************
To clear temporary Internet files:
*******************************************************************
Set WshShell = CreateObject(“WScript.Shell“)
WshShell.run “RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8

*****************************************************************************************
To Clear Browsing History
*****************************************************************************************
Set WshShell = CreateObject(“WScript.Shell“)
WshShell.
run “RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1″

Thursday, September 20, 2012

DotNetFactory in QTP

*******************************************************************************************
DotNetFactory :
*******************************************************************************************

DotNetFactory is a new utility object of QTP , which enables QTP scripting to directly access methods and properties of a .NET object by creating an instance of this object.

To use DotNetFactory, you will first need to create the object instance. To create the object instance use ‘CreateInstance’ method.



Syntax : DotNetFactory.CreateInstance (TypeName [,Assembly] [,args])


********************************************************************************************
Below is the example to create the simple userfrom using  DotNetFactory:
********************************************************************************************

function UserLoginForm()

Set objForm = DotNetFactory.CreateInstance("System.Windows.Forms.Form", "System.Windows.Forms")
Set objBtn1 = DotNetFactory.CreateInstance("System.Windows.Forms.Button", "System.Windows.Forms")
Set objLbl = DotNetFactory.CreateInstance("System.Windows.Forms.Label", "System.Windows.Forms")
Set objPassword = DotNetFactory.CreateInstance("System.Windows.Forms.TextBox", "System.Windows.Forms")
Set objLbl2 = DotNetFactory.CreateInstance("System.Windows.Forms.Label", "System.Windows.Forms")
Set objUserName = DotNetFactory.CreateInstance("System.Windows.Forms.TextBox", "System.Windows.Forms")
Set objRegion = DotNetFactory.CreateInstance("System.Windows.Forms.ComboBox", "System.Windows.Forms")
objForm.Left=500
objForm.Top=250
objForm.Height=275
objUserName.Top=40
objUserName.Left=100
objPassword.Top=70
objPassword.Left=100
objPassword.UseSystemPasswordChar=True
objForm.CancelButton = objBtn1
objLbl.text = "User Name"
objLbl.Top=40
objLbl.Width=80
objLbl.left=20
objLbl2.text="Password"
objLbl2.Top=70
objLbl2.Left=20
objLbl2.Width=80
objRegion.Items.add "DEV"
objRegion.Items.add "QA"
objRegion.Items.add "PROD"
objBtn1.text = "OK"
objBtn1.Top=170
objBtn1.Left=95
objBtn1.Width=120
objBtn1.Height=30
objUserName.TabIndex=1
objPassword.TabIndex=2
objRegion.TabIndex=3
objBtn1.TabIndex=4
objForm.controls.add(objLbl)
objForm.controls.add(objLbl2)
objForm.controls.add(objUserName)
objForm.controls.add(objBtn1)
objForm.controls.add(objPassword)
objForm.controls.add(objRegion)

objForm.StartPosition = CenterScreen

objForm.Text = "Regression Testing"
objForm.showDialog

Environment.Value("vUserName") =objUserName.text
Environment.Value("vPassword")=objUserName.text
Environment.Value("vRegion")=objRegion.Text

end function

Dictionary Object in QTP

Dictionary Object :

***************************************************************************************************************
Dictionary object is similar to an associative array. Every unique key presnt in the dictionary object has a corresponding value.

**************************************************************************************************************
Advantages of using the “Dictionary Object”:
***************************************************************************************************************
1) One advantage of using a dictionary object is that the values assigned to the variables can be accessed from all actions (local and external).
2) Any amount of run time values can be stored to and retrieved from the dictionary object.
3) We can use this as one of the parameterization techniques to pass values in QTP.
 4)We can return multiple values from functions

***************************************************************************************************************
Simple example is shown below to illustrate the usage of the dictionary object.
***************************************************************************************************************

 Set dictObj = CreateObject(“Scripting.Dictionary”)
 dictObj.Add “a”, 1
 msgBox dictObj(“a”)
*****************************************************************************************************************
Note : This would display the value “1” in the message box. The first 2 statements can be present in one action say Action 1. If the 3rd statement is executed from another action say Action 2, it would still work as dictionary objects are accessible from all actions.

***************************************************************************************************************
Some of the methods associated with the dictionary object are:

***************************************************************************************************************
 Items Method (object.Items( ) )
**************************************************************************************************************
        Returns an array containing all items in the dictionary object.

**************************************************************************************************************
Exists Method (object.Exists(key))
**************************************************************************************************************                  Returns true if a specified key exists in the Dictionary object, false if it does not.

**************************************************************************************************************
Keys Method (object.Keys( ))
***************************************************************************************************************
          Returns an array containing all existing keys in a Dictionary object.

**************************************************************************************************************
 Remove Method (object.Remove(key))
**************************************************************************************************************          Removes a key, item pair from a Dictionary object.

**************************************************************************************************************
 RemoveAll Mthod (object.RemoveAll))
**************************************************************************************************************
          The RemoveAll method removes all key, item pairs from a Dictionary object.
**************************************************************************************************************






Tuesday, September 4, 2012

SQL Commands

SQL Commands:


SQL commands are instructions used to communicate with the database to perform specific task that work with data. SQL commands can be used not only for searching the database but also to perform various other functions like, for example, you can create tables, add data to tables, or modify data, drop the table, set permissions for users. SQL commands are grouped into four major categories depending on their functionality:

 Data Definition Language (DDL) - These SQL commands are used for creating, modifying, and dropping the structure of database objects. The commands are CREATE, ALTER, DROP, RENAME, and TRUNCATE.

 Data Manipulation Language (DML) - These SQL commands are used for storing, retrieving, modifying, and deleting data. These commands are SELECT, INSERT, UPDATE, and DELETE.

 Transaction Control Language (TCL) - These SQL commands are used for managing changes affecting the data. These commands are COMMIT, ROLLBACK, and SAVEPOINT.

 Data Control Language (DCL) - These SQL commands are used for providing security to database objects. These commands are GRANT and REVOKE.

Tuesday, August 21, 2012

QTP SendKeys


In QTP below are the three ways we can send keyboard keys:

1)Using Type method
2)Using Sendkeys method
3)Using DeviceReplay object

*********************************************************************************
 Send the keys using Type method:
*********************************************************************************
Window(“Notepad”).Activate

Window(“Notepad”).WinEditor(“Edit”).Type "MicTAB"

*********************************************************************************
Send the keys using Sendkeys method:
*********************************************************************************
Set WshShell= CreateObject("WScript.Shell")

WshShell.Run "notepad"

'To write the letters
WshShell.SendKeys "RealworldQTP"

'to press Tab in the keyboard
WshShell.SendKeys "{TAB}"  

'To press Enter in the keyboard
 WshShell.SendKeys "{ENTER}"

 'To send the combination keys
WshShell.SendKeys “^c”   'here '^' represents Ctrl key  in the keyboard  

*******************************************************************************
 Send the keys using DeviceReplay object:
*********************************************************************************
Set obj = CreateObject(“Mercury.DeviceReplay”)
Window(“Notepad”).Activate
obj.PressKey 63

Note :Here 63 represents F5(ASCII value of F5 key is 63)

Wednesday, August 8, 2012

How to download QTP 11.0 trail version?


QTP 11.0 trail version download


1)Goto Below HP site:

          http://www8.hp.com/us/en/software-solutions/software.html?compURI=1172122#tab=TAB3

2) Click on Trail software under resources tab and click on below link

          HP Unified Functional Testing (with QTP) English Evaluation (GUI and API testing)

3 )Once click on above link site will ask for the personal details, enter all required data and click on next

4) Next page it will ask for Terms of Use, click on I agree button

5) Click on download button with name “HP QTP 11.00 Eval Package Eng SW E-Media”

Monday, August 6, 2012

ChildObjects in QTP

********************************************************************************
What is Chiledobjects in QTP:
********************************************************************************
      To count the number of same class object present in the window or page

********************************************************************************
Example:
********************************************************************************

Set obj=Description.Create
obj("micclass").value="WinButton"
Set objcol=Window("Flight Reservation").ChildObjects(obj)
msgbox objcol.count
********************************************************************************
'To get the property value of all objects:
********************************************************************************
For i=0 to objcol.count-1
msgbox objcol(i).getroproperty("name")
Next
********************************************************************************



Friday, August 3, 2012

Parameterization


*******************************************************************************
Parameter:

******************************************************************************* 
parameter is a special kind of variable, used in a function to refer to one of the pieces of data provided as input to the function.

 *******************************************************************************
Parameterization:

 *******************************************************************************
Parameterization is the process of replacing variable with a value.
 *******************************************************************************
Advantages of Parameterization:
*******************************************************************************
  • Parameterization allows us to pick different value at run time.
  • Reduces time and effort
  • it greatly increases the power and flexibility of our test
  • parameterization allows to perform data driven testing
 *******************************************************************************
 Without Parameterization:
*******************************************************************************
WinEdit(“Login”).Set “hi”
WinEdit(“Login”).Set “hello”
WinEdit(“Login”).Set “QTP”
 *******************************************************************************
 With Parameterization:

 *******************************************************************************
WinEdit(“Login”).Set DataTable(”Name”, dtglobalsheet)

*******************************************************************************
We Can do Parameterization in three ways:
*******************************************************************************
  • Using Data Table
  • Using Environment variables
  • Using Random number

Recording Modes

There are three types of recordings in QTP:


1) Normal Recording:

2) Analog Recording:

3). Low-Level Recording:

******************************************************************************
 Normal Recording:
******************************************************************************
           This is the default mode in QTP. It recognizes the objects in the application regardless of their location on screen.
For recording just click on Record button in QTP and start recording.

******************************************************************************
Analog Recording:
******************************************************************************
           In this recording QTP records and tracks every movement of the mouse as you drag the mouse around a screen or window.

******************************************************************************
Low-Level Recording:
******************************************************************************
            In this recording, QTP records the object in terms of its X and Y coordinators on the screen.

******************************************************************************

Thursday, August 2, 2012

Why GetROproperty,GetTOProperties and SetTOProperty

*************************************************************************
GetRoProperty:
*************************************************************************
    To get  the Runtime object propertie values

Example:

'In flght reservation application while inserting order,Order Number will get generated at runtime
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("New").Click
Window("Flight Reservation").WinObject("Date of Flight:").Type "121212"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "QTP User"
Window("Flight Reservation").WinButton("Insert Order").Click
Wait 4
vOrderNumber = Window("Flight Reservation").WinEdit("Order No:").GetRoProperty("value")
 *************************************************************************
GetTOProperties :
*************************************************************************

                   We can get the property values of test objects,i.e For QTP which properties are helpful to identify the object 

Example:

  
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("New").Click
Window("Flight Reservation").WinObject("Date of Flight:").Type "121212"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "QTP User"

msgbox Window("Flight Reservation").WinEdit("Name:").GetTOProperties ("name")
*************************************************************************

SetTOProperty:
*************************************************************************

             We can Modify the object property values at run time

Example:

r.Activate

Window("Flight Reservation").WinButton("New").Click
Window("Flight Reservation").WinObject("Date of Flight:").Type "121212"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly From:").SetTOProperty “attached text”, “Fly To:”
Window("Flight Reservation").WinComboBox("Fly From:").Select "Los Angeles"


Note:Here we don't need to add FlyTo object to OR











Reporter Object in QTP


*********************************************************************************
 ReporterObject:
*********************************************************************************

Using Repoter object we can send the customize results QTP result window

Below are the methods to work with Repoter object

• ReportEvent Method

• Filter Property

• ReportPath Property

• RunStatus Property

*********************************************************************************
ReportEvent Method:
*********************************************************************************

ReportEvent Method is used to send the user events to result  window

Syntax:
Reporter.ReportEvent EventStatus, ReportStepName, Details     For Reporterevent we need Pass the  three argumrnts
 1)EventStatus (Micpass,MicFail,micDone,micWarning)
 2)ReportStepName : Executing StepName
3)Details  := Description  about the  ReportStepName   ********************************************************************************
 Filter Property:

*********************************************************************************       
 By using Filter property we can filter the Eventstatus of the result window

  Example: Reporter.Filter = mode  

Modes:
 micPass
 micFail
micWarning
micDone    

If  mode is micPass it will filter the all passed steps 

 *********************************************************************************
ReportPath Property:
*********************************************************************************

Msgbox Reporter.ReportPath
It will give the path of result stored location
  *********************************************************************************
RunStatus Property:
*********************************************************************************  
Msgbox  Reporter.RunStatus
 It returns the status of current test during the test run.         


       
 
       


Tuesday, July 31, 2012

Recovery Vs On error Resume Next

*********************************************************************************
What is Recovery and  On error Resume Next?
*********************************************************************************
        Recovery scenario mechanism  and On error Resume Next both are used to avoid the effect
of unexpected errors caused by the application as well as script

*********************************************************************************
Why Recovery and On error Resume Next?
*********************************************************************************
         As automation test engineer we need to develops the scripts such away that scripts shouldn' t effect  even if any unexpectd error occurs

*********************************************************************************
Genaerally while executing scripts we may get two types of unexpected errors

1)Error From application
2)Error From Script

*********************************************************************************
How to handle the Error in the application?
*********************************************************************************
                      To handle the Unexpected errors in application we will use QTP recovery scenarios mechanism or by VB script if else condition

*********************************************************************************
How to handle the Error in the Script?
*********************************************************************************
            To handle the Unexpected errors in script we will use VB script On error resume next

*********************************************************************************


On error Resume Next

**********************************************************************************
Why On Error Resume Next:
**********************************************************************************
To avoid the unexpected errors caused by the script

**********************************************************************************
What "On Error Resume Next" will do?
***********************************************************************************
These Statment will supress the error produced by the script and resumes the next step

***********************************************************************************
On Error Goto 0
***********************************************************************************
These will be helpful to disabled the Activated On error resume next statement

***********************************************************************************
Err Object :
***********************************************************************************
In VB Script every single statement will produce the Error number,if it is Zero stament is correct else statment is false

***********************************************************************************
To get the error number :
***********************************************************************************
msbox Err .number

***********************************************************************************
To get the error Description:
***********************************************************************************
msgbbox Err.Description

***********************************************************************************
To clear the error:
***********************************************************************************
Err.Clear

Note: When We get the error number through Err object, we should explicitly clear the error number,otherwise script will carries only one number
***********************************************************************************
To raise the error:
***********************************************************************************
Err.Raise

***********************************************************************************
Note : On Error Resume Next will handle the only Script error not application errors
***********************************************************************************





Monday, July 30, 2012

Run Modes

************************************************************************************
Run Modes:
************************************************************************************
Run modes are three types

1)Normal Run
2)Fast Run
3)Update Run
************************************************************************************
Normal :
************************************************************************************
           Displays execution marker for showing the current execution step.
************************************************************************************
Fast :
************************************************************************************:
            Execution will be faster than the normal run mode,even it won’t show the execution marker
************************************************************************************
Update :
************************************************************************************           QTP is having Update Run mode for updating test object descriptions, the expected checkpoint values, and/or the Active Screen images and values.
************************************************************************************
Note : Update run mode doesn't update parameterized values like Data Table data and environment variables.
************************************************************************************

Saturday, July 28, 2012

QTP Environment Variables


Why Environment Variables:

1)We can get the information related to OS(Operating System),test name, testpah & result path
2)We can share the data across the actions like global variables
*********************************************************************************
Environment Variables are two types:
*********************************************************************************
1)Built in 
2) User Defined

*********************************************************************************
Built in :
*********************************************************************************                                    These are the variables which we can't modify at any time


Example: 

To get the test path
msgbox environment.Value("TestDir")


To get the OS name
msgbox Environment.Value("OS")


To get the HostName:
msgbox Environment.Value("LocalHostName")


*********************************************************************************
User defined Env Variables:
*********************************************************************************
      Here user can create the variables depend on the requirement


Again these are two types


1)Internal
2)External


Internal :
     If user is defined the variables with in QTP that variable are called the Internal Variables
External :
     Even User can define the Varibles outside the QTP i.e XML, these variables we can import into QTP called External variables


*********************************************************************************
Note :We can export the Internal variables into XML file
*********************************************************************************















Recovery Scenarios


 Recovery scenario manager provides a wizard that guides you through the defining recovery scenario. Recovery scenario has three steps:

  • Triggered Events
  • Recovery steps
  • Post Recovery Test-Run
*******************************************************************************
Triggered Events:
*******************************************************************************
Popup Window:
QuickTest detects a pop-up window and identifies it according to the window title and textual content.

Object State:
QuickTest detects a specific test object state and identifies it according to its property values and the property values of all its ancestors.

Test Run Error:
QuickTest detects a run error and identifies it by a failed return value from a method

Application Crash:
QuickTest detects an application crash and identifies it according to a predefined list of applications.

*******************************************************************************
Recovery
*******************************************************************************


Select type of recovery operation and click on next.
Keyboard or mouse operation:
                QuickTest simulates a click on a button in a window or a press of a keyboard key. Select this option and click on Next to continue to the Recovery Operation.

Close application process:
                  QuickTest closes specified processes. Select this option and click on Next to continue to the Recovery Operation – Close Processes Screen.

Function call:
                QuickTest calls a VBScript function. Select this option and click Next to continue to the Recovery Operation – Function Call Screen.

Restart Microsoft Windows:
                QuickTest restarts Microsoft Windows. Select this option and click Next to continue to the Recovery Operations Screen.

*******************************************************************************
Post Recovery
*******************************************************************************

 Repeat Current Step and Continue:
                     Repeats the current step is the step that QuickTest was running when the recovery scenario was triggered.

 Proceed to next step:
                  This will skips the step that QuickTest was running when the recovery scenario was triggered.

 Proceed to next action or component iteration:
                  Goes to next action iteration after completion of recovery operation.

 Proceed to next test iteration:
                  Goes to next test iteration after completion of recovery operation.

 Restart current test run:
                 To restart the testrun after completion of recovery operation.

 Stop the test run:
                 To Stop the Entire Test Run.

******************************************************************************************************************************************************************

Difference between Dim and Redim

*********************************************************************************
Dim :
************************************************************************  ***
Dim is used to  declare the variables
*********************************************************************************
Redim : 
*********************************************************************************
 Redim Is used to re size the array variables
*********************************************************************************
Preserve :
*********************************************************************************
Preserve is the word we can preserve the last array values
*********************************************************************************


Example:

Dim a()

ReDim a(3)

a(0) = "1"

a(1) = "2"

a(2)= "3"


Redim preserve a(5)

a(3) = "14"

a(4) = "15"

*********************************************************************************
Note: if we are using redim statement with out preserve key, it will not preserve the previous array value & will creates fresh array
*********************************************************************************

Working with System Environment variables

 
System Environment variables are two types

1)User Variables
2)System Variables

*********************************************************************************
User  Variables :
*********************************************************************************
          In user specific, user or admin can declare the variables

Syntax:


Set Obj = CreateObject("wscript.shell")
set objEnv = Obj.Environment("User")
sUserName = objEnv.Item("UserName")  'these variable should be declare in User environment variables

*********************************************************************************
System  Variables :
*********************************************************************************
         In System specific only admin can declare the variables

  Syntax:


  Set Obj = CreateObject("wscript.shell")
  set objEnv = Obj.Environment("System")
  sUserName = objEnv.Item("UserName") 'these variable should be declare in System environment variables

*********************************************************************************

Adv of Automation


  •  Avoid the errors that human make when they get tired after multiple repetitions.
  • The test program wont skip any test by mistakes.
  •  Each feature test cycle will take less time & Required less
  •   human intervention.
  •  Required for Easy cycle of Regression Testing.

Working with WebTable


Below are the methods to work with Webtable

*********************************************************************************
ChildItem:
*********************************************************************************

This method is to access child objects from a web table cell in web table object without using description object.

EX:

Browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The best").WebTable("Yahoo! ID:").ChildItem(r,c,"WebEdit",index)

*********************************************************************************
ChildItemCount:
*********************************************************************************
           Returns the number of objects of a specific class type in the specified cell.

EX:

Browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The best").WebTable("Yahoo! ID:"). ChildItemCount(r,c,"WebEdit")

*********************************************************************************
GetCellData :
*********************************************************************************
This method is to retrieve data specific row and column from webtable.

EX:

Browser (“Browser").Page (“Page").Frame ("Frame_3").WebTable ("Job ID_2").GetCellData (3, 5)

*********************************************************************************
GetRowWithCellText:
*********************************************************************************
This method is to retrieve the row number based on text which is present in webtable cell.

EX:

Browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The best").WebTable("Yahoo! ID:").GetRowWithCellText(“Text”)
*********************************************************************************




Object Identification


Every test automation tool is GUI (graphical user interface)sensitive. Test automation tool has to identify the objects on the application, then only it can do the intended operations.
QuickTest Professional has its own mechanism to identify the objects on the Application Under Test. QTP has various add-ins available for different applications. Let us have a look at the QTP’s object identification mechanism.

QTP identifies the objects with the following properties:
  1. Mandatory properties
  2. Assistive properties
  3. Smart identification
  4. Ordinal identifier
Location
Index
Creation time(only for browser object)

QTP identifies the objects with Mandatory properties, if the object does not contain these properties then it will go ahead with the Assistive properties. If both are absent (not added to Object Repository as they are absent for a particular object) then it uses either smart object identification (if enabled) or Ordinal Identifiers (location or index of an object).

Thursday, July 26, 2012

FileSystemobject


**********************************************************************************
FileSystemobject
**********************************************************************************

As part of our automation Some times we need to interact with text files,folders & Drives,these we can done using filesystemobject

**********************************************************************************
CreateTextFile:
**********************************************************************************
Description :We can create the new file

Syntax:
Set FSO = createobject("scripting.filesystemobject")
set Fpt = FSO.CreateTextFile(Pathoftextfile)

**********************************************************************************
OpenTextFile:
**********************************************************************************

Description : We can call the Existing file

Syntax:
Set FSO = createobject("scripting.filesystemobject")
set Fpt = FSO.OpenTextFile(Pathoftextfile)

 **********************************************************************************
Read all :
**********************************************************************************
Description :Usign readall we can read the all data from the text file

Syntax:
Set FSO = createobject("scripting.filesystemobject")
set Fpt = FSO.CreateTextFile(Pathoftextfile)
Fpt.Readall

**********************************************************************************
Readline :
**********************************************************************************
Description : Using readline we can read the line from the text file

Syntax:
Set FSO = createobject("scripting.filesystemobject")
set Fpt = FSO.CreateTextFile(Pathoftextfile)
Fpt.Readline

**********************************************************************************
WriteLine :
**********************************************************************************
Description : Using WriteLine we can write the data to text file
Syntax:=
Set FSO = createobject("scripting.filesystemobject")
set Fpt = FSO.OpenTextFile(PathOfTextFile)
Fpt.WriteLine "QTP"

**********************************************************************************
Below are the some more methods to work with text files & folders
**********************************************************************************


DeleteFile

FileExists

CopyFile

MoveFile

CreateFolder

DeleteFolder

FolderExists

CopyFolder

MoveFolder

GetFileVersion
**********************************************************************************





Actions in QTP


******************************************************************************
Actions

******************************************************************************

Action is the concept from QTP,using which we can implement the modularity    

There are totally 3 three types of Actions:

 1.Reuabale action.
 2.Non reusbale action.
 3.External action
   default one is the non resubale action.
******************************************************************************
Non-reusable Action:
       The action which can't be called by any other test apart from the one in which it is created.
Reusable Action: 
    An action which can be called by any number of tests
External Action:

     This is a reusable action, which can't be modified in any other test. It can be just called and
used...

******************************************************************************
 Calling actions:

Call to copy action:
    if we are calling action with these option, the created action we can modify in the called test

 Call to existing actions : 
     if we are calling action with these option, the created  action we can't modify in the called test
******************************************************************************
Spliting Actions:
   We can Split an action into two actions
SplitAction Types:

Nested Action :
    If we split an action with Nested option,created two actions will be depedent to each other

Independent Action :
   If we split an action with Indepedent option,created two actions will be indepedent to each other
******************************************************************************

Q)Can we Merge two actions?
  No
******************************************************************************

Q) What is the difference between attheendoftext and ofterthecurrentstep?

  Generally while creating newaction qtp will ask for above two option
  if we are selecting "attheendoftext" option,the created new actions will be the  indepedent to current action
  if we are selecting "ofterthecurrentstep" option,the created new actions will be the  depedent(nested) to current action
******************************************************************************

Q)if we split one action,the respetive action object repository will be split or not?
  No.
******************************************************************************





Wednesday, July 25, 2012

List of QTP Utility Statments


List of QTP utility Statements:

  • DescribeResult Statement
  • ExecuteFile Statement
  • ExitAction Statement
  • ExitActionIteration Statement
  • ExitComponent Statement
  • ExitComponentIteration Statement
  • ExitTest Statement
  • ExitTestIteration Statement
  • GetLastError Statement
  • InvokeApplication Statement
  • Print Statement
  • RegisterUserFunc Statement
  • RunAction Statement
  • SetLastError Statement
  • UnregisterUserFunc Statement
  • Wait Statement

 In next Post i will give the brief detials about above statments

Synchronization in QTP

Synchronization :

                Synchronization is a process to make the Automation tool(QTP) wait for the application process to complete prior to moving to subsequent steps.
How can we  achieve this,  it can be done in the following ways.

    1. Inserting the synchronization point.
    2. Increasing the Browser Navigation timeout.
    3. Increasing the Object Synchronization timeout
    4. Using Browser Sync method    
    5. Inserting the  Wait/Exist statement.

  Synchronization Point :
  •  One can Insert a Synchronization point during a recording session on an application object and ensure the tool waits for the object to get fully functional prior to  continuing with subsequent steps.
  • One can insert a Synchronization Point by navigating to Insert -> Synchronization  Point , using the  Hand Icon to select an object on the application window.
  • Select a Property Name for this object for which synchronization is to be defined.
  • Once the synchronization point is defines, a waitproperty statement gets generated  in the expert view and  an operation with waitproperty in the keyword view.
  • Increasing the Browser Navigation timeout  would enable QTP to wait for the browser to navigate to the desired webpage.
  •  Increasing the Object Synchronization timeout would enable QTP to wait for the objects on the UI  to appear .
     Both the Above properties are accessible by navigating through File -> Settings tab.
  • Sync : Used to make QTP wait for  application to navigate to a specified page.
  • Wait : This would make QTP wait for the time specified in the wait statement.
  • Exist : This would make QTP wait for the time specified in the exist statement till the object exist or the time gets elapsed.

Tuesday, July 24, 2012

What is ROI in automation?


ROI(Return On Investment)

Automated software testing invariably sounds good to IT quality assurance (QA) managers. Intuitively, you see that creating an automated test one time and then running it hundreds or thousands of times will enable you to expand test coverage, find defects earlier, and focus manual test effort where it is really needed. That has to save the company money and reduce business risk, right? But when you submit budget requests for test automation software or services, chief financial officers (CFOs) want more. They evaluate every expenditure based on how much money it will make or save the company, so you must show them what returns the
company can expect on the investment.

Environment needs for QTP


System Requirement     : IBM-PC (or) Equivalent to P3
Hardware Drive              : 250MB of Free Memory space
RAM                                 : 256MB of RAM
OS                                     : M/S windows 2000 server with 3-4 service pack
                                            

Friday, July 20, 2012

QTP concepts

Hi All, i am going to intiate the blog creation for qtp concepts..this should be useful for beginners as well as Professionals.Please share your ideas if any


Thanks,
Gkchowdary A