Professional Documents
Culture Documents
SESSION OBJECTIVES
Introduction to Automation Benefits of Automated Testing Automated Testing Process Introduction to QTP and its Salient Features Environment Supported
WHAT IS AUTOMATION
A software program that is used to test another software program, this is referred to as Automated software testing. Test Automation is the use of software to control the execution of tests & the comparison of results- actual with the predicted/expected. A third party tool is used to test the application. Use of automation tools reduces the test time as well as the cost
WHY 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.
FALSE BENEFITS
Fewer tests will be needed It will be easier if it is automated Compensate for poor design No more Manual Testing
Usability testing
Ad hoc/random testing
WHAT ARE THE DIFFERENT TOOLS AVAILABLE IN THE MARKET (FOR FUNCTIONAL TESTING) Rational Robot Win Runner QTP Silk Test QA Run Web FT
Quick Test Professional 5.6 Nov 2002 6.5 2003 8.0 2004 8.2, 8.3 2005 9.0,9.1-2006 9.2- 2007 Mercury Interactive 9.5 2008 H.P 10.00 2009 January
QTP Launched in 2002 (Nov). By Mercury Interactive. Later taken over by HP, in 2007. QTP is an Object Based Testing Tool. (Object based means; QTP Follows Test Object Model for Performing Testing operations. Based on either Test Objects or Automation Objects or Utility Objects only, we can automate test operations) QTP is for Functional and Regression Testing. (Basically QTP is a Functional and Regression Test tool but we can use it for little bit Compatibility Testing and Performance Testing). It follows Keyword Driven Approach. (Keyword Driven Approach means; Keywords example Commands, functions, methods, statements etc.. are used for creating Test scripts) It supports Windows Operating Environment only. (QTP basically depends on User Interface to automate test operations and it is not depends on server side interactions, where as LoadRunner depends on server side Operations, so HP developed LoadRunner for Windows as well as UNIX versions). It supports GUI based (Graphical user interface) and Web based Applications Automation, does not support CUI (Command user interface) Applications. It has multilingual support. (It supports English, Chinese, Japanese, Korean, etc languages with respect to license.) It has adapted Microsoft Visual Basic Scripting edition for programming and Excel like spread sheet for Data driven testing.
EX: In the Authentication screen when the name of the button is changed to Sign In form Login, Just make an update in the Object Repository.
CONTD.
After running a test QTP displays the results in a tree structure and in clear visual reports Scripting Language is VBScript which is easy to use , understand and program even complex functionalities with ease. Library files contains VBScript functions and subroutines that can be added to the test.
ADD-IN MANAGER
ADD-INS
Default
ActiveX y Visual Basic y Web
y
Additional
y y y y y y
Java Oracle PeopleSoft .NET Terminal Emulator Sap, Siebel & Web services
Record and playback tool It has additional features like sync pt, check pt, output values It has Built in functions It has User defined functions , Registered functions.
ENVIRONMENTS SUPPORTED
Browsers
Netscape y Internet Explorer y AOL
y
Operating Systems
y y y y y
KEYWORD VIEW
EXPERT VIEW
START RECORDING ON ANY WEB SITE. CHOOSE TEST > RECORD OR CLICK
THE
The test can be saved into a Windows file system (as below). If TestDirector is available and connected with QTP, the test can be saved there. QTP creates an entire structure of files and directories to support a single QuickTest script for each saved test.
Use the Run button to begin playback from the top of the test. Select the location of the test results- either a new results folder or a temporary folder.
Test results can be stored in their own location (for documentation) or in a temporary location that is overwritten each time the test is run (debugging).
MODES OF RECORDING
Normal
mode recording based on properties of GUI Analog mode mouse movements, clicks, keyboard strokes Low level records any object irrespective of support from QTP. Recognizes all run time objects as windows objects. It is used when an object is not identified by Quick test and co-ordinates based.
RUNNING A SESSION
The Run option can be used to run the test from start to end. The Run from Step option in the Test menu is used to run the test from a selected step to the end of the current action, if running from the Expert View, or to the end of the test , if running from the Keyword View. Thus it enables us to check a specific part of the application or to confirm that a certain part of the test runs correctly.
QTP captures these object properties during recording. Logical Name Logical name is a value QuickTest usually takes from one of the object properties (like TEXT) to refer to the object in the recorded script.
OBJECT REPOSITORY
Object
Repository is nothing but a storage location. It contains the collection logical name and physical description of a particular object.
Object Repository is a location within the test structure where QuickTest stores object information captured during recording. The Object Repository can be used to: y Rename logical names for readability. y Add a new object in the repository. y Configure the object properties used to identify an object.
While
playback of scripts, qtp refers object repository for identifying the objects
OBJECT REPOSITORY
Two
types Per action, Shared Repository The Object Repository can be Per Action or Shared. The shared repository can be used by multiple actions of the same test or by actions from different tests. Test object properties are prone to frequent updation. Per Action object repository is used by one or very few tests. Test object properties are modified less frequently.
OBJECT REPOSITORY
OBJECT RECOGNITION
Mandatory properties QTP always learns for differentiating objects Assistive properties optional properties learnt when mandatory couldnt able to differentiate
OBJECT RECOGNITION
Ordinal
Identifier This is used when both mandatory and assistive couldnt help to differentiate objects Ordinal identifier uses location indicator and index indicator to differentiate objects
OBJECT IDENTIFICATION
Object
identification is another component in QTP. This is used to configure the mandatory and assistive properties depending on application to be tested.
OBJECT IDENTIFICATION
OBJECT SPY
Object
spy is a component in QTP that helps to list the test object and runtime properties of the GUI Lists the methods and syntax that could be implemented on that particular object Lists the hierarchy of the object in the AUT
CHECKPOINTS IN QTP
A checkpoint is a verification point that compares a current value for a specified property with the expected value for that property.
TYPES OF CHECKPOINTS
Standard Checkpoint Bitmap checkpoint Text checkpoint Text Area checkpoint Database checkpoint XML Checkpoint
Standard Checkpoint
Bitmap Checkpoint
Checks the property value of the object in an application or Webpage. It checks buttons,Radiobuttons,C omboboxes etc Checks the value of an image in the application.
Text Checkpoint
Checks whether the text string is displayed in the appropriate place in your application or on a Web page
Database Checkpoint
Checks the contents of a database accessed by the application Checks the data content of XML documents in the application.
XML Checkpoint
Expected Result
Actual = expec ted ?
Execute checkpoint Object: Button Logical Name : OK Property: Enabled Value: True
WEB
Browser Text Area Text Link Images Image Link Edit Field Drop down list Checkbox Radio Button Tables/ Grids Web Element
Do not automatically select the pre-defined list of properties to check. Scroll down the property list to find the property( or properties) that best meets the test requirement.
TABLE CHECKPOINT
DATABASE CHECKPOINT
Choose Insert > Checkpoint > Database Checkpoint. The Database Query Wizard opens.
OUTPUT VALUES
Outputs
the value of properties of GUIduring runtime Can be viewed in runtime data table in results window Mainly used to get collection of property value of dynamic objects
PARAMETRIZATION
Parameterization - Passing multiple set of values for testing A parameter is a variable that is assigned a value from an external data source at run time. We use parameterization when we want to change the value of properties at run time.
XL sheet in QTP for passing values to parameters in runtime Two sheets global and action Global Data is passed to all actions within the script Action Data is passed to only particular action
WAYS TO PARAMETRIZE..
Data
table parameter Passing through data table Action/component parameter By declaring input and output parameter in action properties Environment parameter External host, url, vuser etc
DATATABLE PARAMETERS
The
Test runs once for each line of data in the DataTable. Each iteration takes a different value from the datatable. choose the Run tab Test Settings
The Environment variables can have Quick Test generated values or values supplied from external files. Test Settings Environment Choose User-defined from the variable type Click New to create your own internal variables
It enables us to use random numbers as values in the test. We can specify the range from which the random number is generated. By default, the random number range is between 0 and 100.
Select the step in the Tree View that contains the recorded input value. Click on the text under Value column.
ACTIONS
A test is composed of actions or logical sections. The steps we add to the test are added within the tests actions. By default, each test begins with a single action. When we run a test with multiple actions, the Test Results are divided by actions so that we can view the detailed results for each action individually. Each action has its own sheet in the Data Table so that we can insert data that applies only to that action.
TYPES OF ACTIONS
Non-re-usable: Action can be used in the local test, only once. Reusable: Action can be used in the local test, multiple times. External: These are reusable actions created in another test. This can be of two types. If a call to an external action is used the action is read only in the calling test. But, any existing action can be inserted as a copy of the original action. In this case, we can modify this copy of the external action in the calling test.
CALLING ACTION
INSERT
CALL TO EXISITING ACTION CALLS A REUSABLE ACTION, BUT ANY CHANGES WILL BE REFLECTED ON ORIGINAL CALLED ACTION INSERT CALL TO COPY OF ACTION CALLS A REUSABLE ACTION, BUT CHANGES ARE NOT REFLECTED ON ORIGINAL CALLED ACTION
TRANSACTIONS
TRANSACTIONS
ARE NOTHING BUT TIMER FOR MEASURING TIME TAKEN FOR EXECUTING PARTICULAR TASK SERVICES.START TRANSACTION T1 SERVICES.END TRANSACTION T1 CAN BE USED ANY NUMBER OF TIMES
DEBUGGING
DEBUGGING FINDING ERRORS IN THE SCRIPT BREAKPOINTS POINT WE CREATE IN THE SCRIPT WHERE THE EXCUTION OF SCRIPT IS PAUSED WATCHLIST MAINLY FOR BETTER DEBUGGING. USED TO VIEW THE VALUES OF THE PARAMETERS/VARIABLES DURING RUNTIME
REGULAR EXPRESSION
\
SYMBOL TO INDICATE IT IS AN REGULAR EXPRESSION . PERIOD MATCHES ONE CHARACTER !WELCOME. CAN MATCH WELCOMES, WELCOMED * - MATCHES ANY NUMBER OF CHARACTER !W*-WHO, WE [] TO INDICATE COLLECTION LIKE !W[E3] WE, W3
REGULAR EXPRESSIONS
-
INDICATES RANGE LIKE [0-9] ^ INDICATES EXCLUSION LIKE [^A-Z] WILL NOT ACCEPT UPPER CASE ALPHABETS + indicates one or more occurrence of preceding character ca+r car, caaar and not cr \w matches all characters except alphanumeric and underscore
FUNCTION? PROCEDURE???
FUNCTION CAN BE INBUILT OR USER DEFINED. IT IS ONE THAT RETURNS A VALUE PROCEDURE IS SIMILAR TO FUNCTION BUT DOESNT RETURN VALUE
GETTOPROPERTY()
GetTOProperty( propertyname) Returns the value of the property Example, A= Dialog(Login).Winbutton(OK).GetTOProperty (Enabled)
GETTOPROPERTIES( )
GetTOProperties() Lists all the properties and property values of particular object
GETROPROPERTY()
GetROProperty(Propertyname) Returns the runtime property of the particular object Dim a A= dialog(login).Winbutton(OK).GETROPROPER TY(nativeclass)
is yes not through wizard but through scripting Set a = createobject(ADODB.connection) A.openDSN = Employee.mdb, Username = xxx, Password = xxxx Set b = createobject(ADODB.RecordSet) B.openSelect * from table1,a Msgbox b.recordcount
FILE HANDLING
Using QTP it is possible to pass datas from various files and write data into file Example to read data from a file Set a = createobject(Scripting.FileSystemObject) Set b = a.opentextfile(path,0/1/8,true) Str = b.readline 0 write mode 1- read mode 8 append True/false file exist or create new
CHILDOBJECTS()
This function is used to return the list of all objects within the window Example to count no of objects within dialog Set c = dialog(Login).childobjects() Msgbox c.count
POPUP()
POPUP(MSG,WAIT TIME, TITLE,BUTTON) EXAMPLE SET A = POPUP(HI,10,GREETING,4) A WILL BE RETUNED VALUE 6(YES) AND 7(NO)
MAXIMIZE WINDOW
MAXIMIZE IS KEYWORD FOR MAXIMIZING WINDOW/DIALOG FULLSCREEN IS THE KEYWORD FOR MAXIMIZING THE BROWSER
DATATYPE CONVERSION
CINT() CONVERTS VAR TO INTEGER CLNG() CONVERTS CURRENCY TO INTEGER CCUR()- CONVERTS TO CURRENCY FORMAT
FUNCTIONS THAT ARE REPEATED FOR MANY TIMES EXAMPLE PUBLIC FUNCTION SUM(X, Y, Z) Z = X+Y END FUNCTION DIM A, B, C A = INPUTBOX (ENTER A) B = INPUTBOX(ENTER B) SUM (A,B,C) MSGBOX C
FRAMEWORKS
FRAMEWORKS ARE SET OF DEFINED RULES FOR AUTOMATING A TESTING PROCESS IT COULD BE SAID AS AUTOMATION TEST APPROACH
FRAMEWORKS
LINEAR
FRAMEWORK RECORDING, ENHANCEMENT , PLAYBACK HERE U CREATE SCENARIOS, DO RECORDING BASED ON SCENARIOS, ENHANCEMENT IS DONE FOR VERIFICATIONS, AND PLAYBACK FOR EXECUTION
FRAMEWORK
DATA DRIVEN HERE AN EXTERNAL DATABASE IS MAINTANINED FOR PASSING VALUES TO THE ACTIONS IN QTP VALUES ARE COMPLETELY PASSED ONLY THRO THIS DATA SETS
FRAMEWORK
KEYWORD DRIVEN USING THE MANULLY ENTERED TABLE THAT DEFINES TESTOBJECT, OPERATION, DATA AND DESCRIPTION, VB SCRIPTS ARE AUTOMATICALLY GENERATED BY QTP
FRAMEWORK
DESCRIPTIVE
PROGRAMMING IT IS A CONCEPT OF EXECUTION OF SCRIPTS WITHOUT THE REFERENCE OF OBJECT REPOSITORY DIALOG(CLASS = DIALOG,CAPTION = Login).Winbutton(class = Button,Text = OK).Click
FRAMEWORKS
FUNCTIONAL/MODULAR HERE THE ACTIONS ARE DECLARED AS USER DEFINED FUNCTIONS THESE FUNCTIONS ARE CALLED WHEREVER NEEDED.
FRAMEWORK
HYBRID FRAMEWORK MIX OF ANY OF THE ABOVE FRAME WORKS ARE CLASSED AS HYBRID. DEPENDING ON COMPLEXITY OF THE APPLICATION, MIXES ARE CHOSEN.