automation testingdoc (kumar qa's conflicted copy 2013 07-08)
DESCRIPTION
TRANSCRIPT
Automation Fundamental Concepts
& QTP At A Glance -
Prepared By : Kumar
AUTOMATION FUNDAMENTAL CONCEPTS
What is Test Automation ?
Software Test Automation is the process of automating the steps of manual test cases using an automation tool Or utility to shorten the testing life cycle with respect to time…
When application undergoes regression, some of the steps might be missed out or skipped which can be avoided in Automation…
Automation helps to avoid human errors and also expedite the testing process…
To implement the Test Automation detailed planning and effort is required
AUTOMATION FUNDAMENTAL CONCEPTS
Automation saves time and effort which results in reduction of the Test life cycle…
Benefits of Automation- Consistency of Test Execution- Reducing cycle time of regression test
cycles- Data driven testing- Repeatability- Coverage- Reliability- Reusability of test wares
AUTOMATION FUNDAMENTAL CONCEPTS
Automation life cycle is a subset of the entire test life cycle…
Automation planning can be initiated in parallel to the test planning phase…
Factors to be considered in automation planning,
Stability of AUT (Application under test) No of regression cycles to be performed Compatibility of App platform with testing tools
Cost benefit analysis (ROI) Availability of skilled resources
REGRESSION TESTING & AUTOMATION
When Automation is applicable?
Regression Testing Cycles are long and iterative.
If the application is planned to have multiple releases / builds
If it’s a long running application where in small enhancements / Bug Fixes keeps happening
Test Repeatability is required
Types of Automated Tools: A black box testing tools are broadly divided into Three
typesFunctional tools (QTP, Win runner)Management Tools (Test Director/Quality Center)Performance tools (Load Runner)
QTP
QTP (Quick Test Professional)Type Of The Tool: Functional ToolCompany: Mercury Interactive
incorporationScripting Language: VB- ScriptVersion:
#5.5,#6.5,#7.0,#7.6,#8.0,#8.2(2005),#9.0,#9.1,#9.2,#10.0,11.0, 11.5 etc
QTP
TESTING PROCESS WITH QTP
Quick Test Pro involves 3 main stages:Creating Test scripts
Running Tests
Analyzing Test Results
TESTING PROCESS WITH QTP
Creating TestsCreate a test script by recording a manual test scenario on the
AUT (Application Under Test) using QTP.
Quick Test Pro graphically displays each step users perform in the form of a collapsible, icon based tree view in QTP’s Keyword View.
TESTING PROCESS WITH QTP
Running Tests & Analyzing Test ResultsRunning Tests:
Once the test scripts are recorded / created, next step is to execute them…While running (executing) the tests Quick Test Pro connects to the web site or AUT and performs each operation in the test as performed manually while recording / creating tests (test scripts)…
Debugging Test : To identify and eliminate the defects in the test scripts.
Analyzing Test Results: Once the test scripts are executed, test results and the summary
can be viewed for result analysis.
ADD-IN MANAGER
Default Add-ins ActiveX Visual basic Web
Other Add-Ins Siebel Java SAP Oracle .Net and many more
ADD-IN MANAGER CONT…
QTP’s Add-in Manager facilitates the users to select the technology / environment from variety of environments suitable for the AUT (Application Under Test)
Once an add-in is loaded, users can record that application in its supported environment and thus QTP recognizes the objects specific to the application under test (AUT) as loaded through Add-in Manager.
It is critical for the users to know the development technologies / environment of AUT, and load right Add-Ins while invoking Quick Test Pro.
QUICK TEST PROFESSIONAL - RECORD & RUN MODES
Recording Modes
NormalAnalogLow level
Run Modes
Normal Fast Update
QUICK TEST PROFESSIONAL - OPTIONS GENERAL
Best Practices for General Options:
Deselect all check boxes except “Save data for integrating with performance testing …” and “Display Add-in Manager on startup” which is default setting.
Click on “Restore Layout” button to reset screens to the initial setting when QuickTest was first installed.
QUICK TEST PROFESSIONAL - OPTIONS RUN
QUICK TEST PROFESSIONAL - OPTIONS RUN
Best Practices for Options for Run Mode: Run Mode as Normal:
This ensures that the execution arrow appears to help with trouble shooting the tests.
Synchronization becomes better for the AUT (Application Under Test)
Test Results: Deselect the option “View Results when run session ends”
Mercury Tool Integration: Select "Allow other Mercury products to run tests and components“
Screen Capture: Save step screen capture to results "On error and warnings"
RECORD AND RUN SETTINGS
RECORD AND RUN SETTINGS
Best Practices for Record & Run Settings,
Set the options to configure QTP to "Record and run test on any open Windows- based application“
Set the option - This window will appear the first time you click on the Record button in the new test.
Manually recall this window by selecting Test Record and Run settings
QTP - MAIN WINDOW
QTP - MAIN WINDOW
QTP - MAIN WINDOW
Test Pane:
Test Pane contains two labs to view the tests,
- Keyword View - Expert View
Keyword View: Quick Test Pro displays your test in the form of a collapsible, icon
based tree…
Expert View: Quick Test Pro displays the source code (VB Script) of the tests in this
view.
QTP - MAIN WINDOW
QTP - MAIN WINDOW
Data Table : Data table assists in Parameterizing the tests… Debug Viewer Pane : It assists in debugging tests with the help of Watch Expressions, Variables, and Command.
QUICK TEST PRO COMMANDS
Quick Test Pro Commands : The Quick Test Pro commands can be chosen from the
menu bar or from a Tool bar.
File Tool bar : File tool bar contains buttons for managing the test.
QUICK TEST PRO COMMANDS
Test Tool bar : Test tool bar contains buttons for the commands used
when creating or maintaining the tests…
QUICK TEST PRO COMMANDS
Debug Tool Bar : It contains buttons for commands used when debugging
the steps in the tests…
QUICK TEST PRO COMMANDS
Action Tool Bar : To view all actions in the test flow or to view the details of a selected action…
QTP screen can be divided in to five parts1)Test Pane2)Active screen3)Data Table4)Debug Viewer Pane5)Tool Options
QTP PARTS
1.Test Pane:Test pane is an area provided by QTP, which is used for developing, viewing, and modifying the test screen.
It represents the test scripts in two viewsI. Expert viewII.Key word viewI. Expert view: It represents the script in VB script formatII. Keyword view: Keyword view represents the script
using a graphical user interface (GUI) which is further divided in to four parts.
ItemOperation ValueDocumentation
QTP PARTS
2. Active Screen:Active screen is an area provided by QTP, which
holds the snapshots of each and every script statements and used for the following.
Easily understanding the scriptEasily enhancing the script.
QTP PARTS
3. Data-Table:The date table is originally called as formula1
sheet developed by third party and integrated with QTPFeatures:
It is used for holding the test dataIt isolates the test script from the data source.It provides the facility to import the test data from
different data sources like excel files, data base and flat files (a file without having format)
It allows the user to interact with the data directlyNote: QTP maintains two copies of data tablesDesign time data tableRun time data table
QTP PARTS
4. Debug Viewer Pane:Definition of Debugging: Debugging Is a process of
executing the script or a program in a user desired passion with some temporary breaks in order to identify the errors.
Debug viewer pane is an area provided by QTP which is used for viewing, modifying or setting the current values of variables or expressions during the execution break with the help of three Tabs by name Watch expression, Variables and Command
5. Tool- Options:All the options available in the menu bar known
as tool-options.
QTP PARTS
RECORDING AND RUNNING:Record and Run Settings: For every new test one has to compulsorily do this settings
before recording or running. These settings will make to understand on which applications it need to concentrate while recording or running.
Navigation:- Go to ‘Automation’ Tab Select the option ‘record and run settings’ Select one of the following options
Record and run test on any opened windows based application Record and run on these application (opened on session start)
If at all second option is selected then click on add button Browse the desired application part Click on OK Click on apply & OK.
RECORDING AND RUNNING:
Operational overview of Recording:Record and Run Settings:
During recording QTP will do the following..It will generate corresponding script statements for
every user action on the application.It will store the required related information in the
object repository.
RECORDING AND RUNNING:
Operational overview of Running:During running QTP will doing the following..It will read the script statement and understands what
action to be performed on which object.Then it realizes it need to identify the object first to
perform the actionTo identify the object it requires some information for
that information it will go the object repository and search.
Once the information is found using this information it will try to identify the original object.
Once the object is identified it will perform the action on it.
RECORDING AND RUNNING:
Recording Modes:There are there types of recording mode(a). Context sensitive recording mode or Normal
recording mode(b). Analog Recording Mode(c). Low-level Recording mode.
RECORDING AND RUNNING:
Recording Modes:1.Context sensitive Recording mode:
It is used for recording the operations performed on the standard GUI object in different situations
2.Analog Recording Mode:It is a special recording mode provided by QTP, which is used for
recording the continuous operations Navigation: Keep the tool under normal recording mode Activate the menu ‘Automation’ test Select the option analog recording Select one of the following option
Record relative to the screen Record relative to the following window
If at all second option is selected specify the window title with the help of the Hand Icon
Click on start analog record
RECORDING MODES:QTP
Recording Modes:3. Low-Level Recording: It is a special recording mode
provided by QTP, which is used for recording at least some minimum operations on the non-supported environments also.
RECORDING MODES:QTP
Object Repository: Object repository is a storage place where one can store the objects information and it also acts as interface between the test script and the AUT(application under test) in order to identify the original objects during execution
Types of Object Repository:There are two types of object repository they are1.Per-Action Repository2.Shared Repository(1). Per-Action Repository:If at all this type is selected as an object repository then the QTP will be
automatically creating and managing an individual repository for every action(MTR modular Test Repository).
(2). Shared Repository:Shared repository has to be created and managed manually once a shared
repository to created it can be shared among number of tests(TSR Test Script Repository)
Advantages: Easy to maintain Re-usability
OBJECT REPOSITORY:QTP
Navigation for creating a shared Repository or Converting a per action in to shared:
Go to>object repositoryClick on exportBrowse the desired location(Drive)Specify the file name with .TSR extensionClick on save button
OBJECT REPOSITORY:QTP
Navigation for Creating the Shared Repository to the currant test:
Go to resources tab>Associate RepositoryBrowse the desired repository fileClick on apply & OK
Note: TSR means Test Shared Repository
OBJECT REPOSITORY:QTP
OPERATIONS ON OBJECT:-Navigation for adding the objects in to the object
repository: Open the object repository Click on add objects button Click on the title bar of the window Click on ok
Select one of the following options Only the selected objects Selected objects and all its direct children Selected objects and all its descendents Click on OK
OBJECT REPOSITORY:QTP
Navigation for deleting the objects form the object repository:
Select the desired object to be deleted in the object hierarchy
Right click on itSelect the option delete YESSelect the option delete Confirm the deleting by
clicking on “Yes”
OBJECT REPOSITORY:QTP
Navigation for Re naming the objects:Select the desired object in the object hierarchyRight click on it Select the option RenameSpecify the desired name
OBJECT REPOSITORY:QTP
Navigation for updating the properties list:Select the desired object in the object hierarchyClick on add/Remove buttonSelect the desired properties to be added in to the
properties listDeselect the properties to be removed from the
properties listClick on OK
OBJECT REPOSITORY:QTP
Overview: Generally for every object 20-25 properties information available, qtp recognizes object using 2 or 3 Important properties.
QTP has default object identification configuration for every environment, if we feel that config is not sufficient for recognizing objects in our application, we can configure some more
OBJECT IDENTIFICATION:QTP
Object Identification TypesA) Normal Identification1) Mandatory Properties2) Assistive PropertiesB) Smart Identification1) Base Filter Properties2) Optional Filter PropertiesC) Ordinal Identifier1)L2) Iocationndex3) Creation Time(Only for Browser)
OBJECT IDENTIFICATION:QTP
QTP Learns Information in the following in case of normal identification
First of all the qtp learns all the mandatory properties at a time and think whether these properties sufficient to identify the object uniquely, if it feels sufficient then it stops learning otherwise,
It learns first assistive property and once again stops and thinks, like this qtp learns one by one. At the end of assistive properties list also if it feels not satisfied and it finally goes to Ordinal Identifier.
OBJECT IDENTIFICATION:QTP
QTP Learns Information in the following in case of Smart Identification:
Smart identification is an optional feature, if we feel normal identification is not sufficient for any object, and then we configure Smart Identification for that object, in order to avoid Ordinal Identifier
After normal Identification if qtp feels not satisfied then it goes to smart identification. In smart identification 2 types of properties available, first qtp learns all base filter properties uniquely. It it feels sufficient, then it stops learning otherwise it goes Optional filter properties and learns one by one.
Still it feels not satisfied finally it goes to Ordinal Identifier
OBJECT IDENTIFICATION:QTP
Ordinal Identifiers:1.Location: If at all the location is selected, as an ordinal
identifier then the QTP will generate a sequence of numbers from 0,1,2,3 based on the sequence of the objects located in AUT.
2.Index:If at all the index is selected as an ordinal identifier than the QTP will generate the numbers from 0,1,2,3…. Based on the sequence of the programs of the objects.
3.Creation Time (specially for web pages):If at all creation time is selected as an ordinal identifier the QTP
will generate the number from 0,1,2,3,… based on the loading time of the web pages
Settingsa)Tools>Object Identification
OBJECT IDENTIFICATION:QTP
Object Spy:Object spy is a handy feature provided by QTP which is used for showing the complete
objects information like list of properties and their values, list of methodology, syntax for methodology and description of methods then and there on the spot immediately of both test objects as well as runtime objects.
Navigation for Object SPY:
Activate the menu item tools Select the Tools> object spy Click on the hand icon Click on the desired object Types Of Objects:There are two types of objects 1.Run time objects 2.Test objects 1.Run time objects:All the original objects present in the AUT are known as run time objects
2.Test Objects:Test objects are the reference objects created by the QTP for run
time objects, stored in object repository and used by the QTP for the original objects
OBJECT SPY: QTP
QTP life cycle contains Six phasesi. Test planningii.Generating the basic testiii.Enhancing the test iv.Debugging the testv.Executing the testvi.Analysis the Results
QTP LIFE CYCLE
I. Test planningIn this phase the automation test lead will do the
following Under standing the requirements Identifying all the areas to be automated Analyzing both the negative and positive flow of the
application Preparing the automation test plan document based
on the analysis Preparing the tool ready with all the pre
configurational settings for the further operations
QTP LIFE CYCLE
II. Generating the basic:In this phase the automation test engineer will generate
the test engineer will generate the basic test for both the +ve and –ve flow of the application
QTP LIFE CYCLE
III. Enhancing the Test:One can enhance the script in the following ways1)Inserting the check points2)Synchronizing the test3)Parameterizing the test (Data Driven Testing)4)Inserting the out put value statements5)Inserting the transactional points for measuring
transactions6)Inserting the programmatic statements7)Adding comments8)Inserting the script statement manually
QTP LIFE CYCLE
1) Inserting the check points: Checkpoint is defined as validation pointer test point
which checks the objects state or bitmap state or data state during execution at any point of time
INSERTING CHECK POINTS
Types Of Checkpoints:
1) Standard checkpoints2) Bitmap checkpoint3) Text checkpoint4) Text area checkpoint5) Data base checkpoint6) XML checkpoint7) Page checkpoint8) Table Check point 9) Image checkpoint10)Accessibility checkpoint
TYPES OF CHECKPOINTS
Standard checkpoint is used for checking the standard GUI objects properties value, it can be inserted in two ways
Through application Through Active Screen
1. Standard checkpoints
Navigation through application:
1)Keep the cursor in the desired location2)Keep the tool under recording mode3)Activate the menu item insert4)Go to checkpoint5)Select the option standard checkpoint6)Click on the desired object in the AUT7)Click on OK8)Select the desired properties to be checked9)Specify the desired expected values10)Click on OK11)Stop Recording
1. STANDARD CHECKPOINTS
Navigation through active screen: Keep the cursor on the desired statement so that the
corresponding snapshot is displayed in the active screen Go to active screen right click on the desired object Select the option insert standard check point Click on OK Select the desired properties to be checked Specify the desired expected values Select one of the following options Select one of the following options
Before current step After current step Click on OK
1. STANDARD CHECKPOINTS
2. BITMAP CHECKPOINTS
Navigation through Application:
Keep the cursor on the desired statement so that the corresponding is displayed in the active screenGo to the active screenRight click on the bit mapSelect the option insert bitmap check point Click on OKIf at all one need to select a part of bitmap then select it using select area buttonIF alt all one need to save only the selected part select the check box save only selected areaSelect one of the following option
Before currant stepAfter currant step
Click on OK
(C). Text Checkpoint:Text checkpoint is used for checking the text present on a specified
object. It can be inserted in two ways Through application Through ActiveNavigation through Active Screen: Keep the cursor on the desired location so that the
corresponding snapshot is available in the active screen
Right Click on the desired position Click on insert text checkpoint Click on desired text Select the following option
Match case Exact match Ignore space
Text not displayed Click on ok
3. TEXT CHECKPOINT
3. TEXT CHECKPOINT
Navigation through Application:Keep the cursor on the desired statement so that the corresponding is displayed in the active screenGo to the active screenRight click on the bit mapSelect the option insert bitmap check point Click on OKIf at all one need to select a part of bitmap then select it using select area buttonIF alt all one need to save only the selected part select the check box save only selected areaSelect one of the following option
Before currant stepAfter currant step
Click on OK
(C). Text Checkpoint:
(d) Text Area Check Point:Test area checkpoint is used for checking the test
presenting a specified area. It can be inserted only through the application but not through the active screen
Navigation through application: Keep the cursor on the desired location of the screen Keep the tool under recording mode Activate the menu item insert Select the opinion text area checkpoint Select the exact area through cross hair pointers Choose the following options
Match case Exact match Ignore space Text not displayed Click on OK Stop Recording
4. TEXT AREA CHECK POINT
(e) Data Base Checkpoint: Data base check point is used for checking the contents of the data base
Navigation: Activate menu item insert Go to check point Select the option data base checkpoint Select the option specify AQL statement manually Click on meet Click on create Click on new Select the desired driver Slick on next Click on finish Click on select Select the desired database Click on ok Click on ok Click on ok Specify the designed query statement Click on finish Select the desired contents to be checked Select one of the following option
Before current step After current step
Click on ok
5. DATA BASE CHECKPOINT
(f) XML Check Point: XML is a universally understandable language which is mainly used for data information
Note: XML check point is used for checking the contents of an XML file
Navigation: Activate the menu item insert go to check point Select the option XML check point Browse the desired XML file Click on OK Select the desired contents to de checked Select one of the following option
Before current step After current step
Click on OK
6. XML CHECK POINT:
This is used for checking the contents of a tableNavigation: Keep the cursor on the desired statements, so that the
corresponding page will be displayed in the active screen Go to active screen Right click on the page Select the option, Insert standard check point Select the desired table in the object hierarchy Click on ok Select the desired properties to be checked Select one of the following option
Before currant step After currant step
Click on ok
7. TABLE CHECK POINT: QTP
This is used for checking the properties of an image Navigation:
Keep the cursor on the desired statement, so that the corresponding page will be displayed in the active screen
Go to the active screenRight click on the pageSelect desired image in the object hierarchyClick on okSelect on okSelect the desired properties to be checkedSelect the one of the properties to be checked
Before currant stepAfter currant step
Click on ok
8. IMAGE CHECK POINT: QTP
• Accessibility check point is used for checking the w3c standards( for web consortium standards) in order to confirm weather the page can be accessed all over the world or not
Navigation: Keep the cursor on the desired statement sot heat the corresponding page is
displayed in the active screen Go to the active screen Right click on the page Select one of the following options
Before currant step After currant step
Click on ok
9. ACCESSIBILITY CHECK POINT: QTP
Synchronization is a process of matching the speeds of both the tool and the application in order to keep them in sync with each other to obtain proper testing results
Here the main concept is making the tool to wait till the application finishes its work it can be done in three ways
1. Inserting the synchronization point2. Increasing the default time3. Inserting the wait statement
SYNCHRONIZATION: QTP
Navigation for inserting the synchronization point:
SYNCHRONIZATION: QTP
Keep the cursor in the desired locationKeep the tool under recording modeActivate the menu item insertGo to step select the option sync pointClick on desired objectClick on okSelect the desired propertySpecify the desired property valueSpecify desired extra timeClick on okStop recording
In order to avoid above navigation one can directly type the statement in the desired location with the following syntax:
SYNTAX: Object hierarchy. Wait property ”Property name” property value, extra time in milliseconds
Example: Window (“flight reservation”).win button(“delete order”).wait property”enabled”,true,17000
SYNCHRONIZATION: QTP
In order to avoid above navigation one can directly type the statement in the desired location with the following syntax:
SYNTAX: Object hierarchy. Wait property ”Property name” property value, extra time in milliseconds
Example: Window (“flight reservation”).win button(“delete order”).wait property”enabled”,true,17000
SYNCHRONIZATION: QTP
Navigation for increasing the default time:-Activate the menu item testSelect the option settingsSelect the run tabSpecify the desired time in milliseconds in
the object synchronization time out fieldClick on apply and okSyntax for Wait Statement:Wait (time in seconds)Example: Wait (17)
SYNCHRONIZATION: QTP
Data driven testing is a concept introduced in the automation in order to implement re- testing
Steps to be followed to perform data driven testing:
DATA DRIVEN TESTING
Collect the test data in to the data tableGenerate the basic testParameterize the testExecute the TestAnalyze the result
Parameterization: Parameterization is a process of replacing the constant values with parameters or variables in order to increase the scope of the test. Parameterize can be done in three ways1.Through data driver wizard2.Through key word view3.Manually
Navigation Through Data Driver Wizard::
DATA DRIVEN TESTING
•Activate the menu item tools•Select the option data driver•Click on parameterize•Click on next•Click on the parameter option button•Select the desired column name•Click on ok•Click on next•Click on finish•Finally click on ok
Navigation Through Key word view: Go to key word viewSelect the desired constant valueClick on configure the value buttonSelect the option parameterSelect the desired column nameClick on ok
To avoid the above navigation one can directly type manually as follows:
1. ''DataDriven Test through Keyword view2. invokeapplication "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"3. Dialog("Login").WinEdit("Agent Name:").Set DataTable("USERNAME", dtGlobalSheet)4. Dialog("Login").WinEdit("Agent Name:").Type micTab5. ''''Data Driven Testing Manually 6. Dialog("Login").WinEdit("Password:").SetSecure DataTable("PASSWORD", 1)7. Dialog("Login").WinButton("OK").Click8. Window("Flight Reservation").WinMenu("Menu").Select "File;New Order"9. Window("Flight Reservation").WinMenu("Menu").Select "File;Open Order..."10. Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"11. '''DataDriven Test through Tools>Data Driver12. Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set DataTable("Open_Order",
dtGlobalSheet)13. Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click14. Window("Flight Reservation").WinMenu("Menu").Select "File;Exit"
DATA DRIVEN TESTING
It is a concept introduced in QTP which is used for calculating the time taken by an application to perform a specific task or the execution time of a block of statement
To do the same QTP has provided two options
INSERTING THE TRANSACTION POINTS
1.Start transaction2. End transaction
Navigation for inserting transaction points: Keep the cursor in the desired locationActivate the menu item insertSelect the option start transactionSpecify the transaction nameSelect one of the following option
Before currant step After currant step
Click on ok
Out put value is a feature provided by QTP, which is used for capturing a value from an application or from a database or from a XML file and stores it under specified column in the runtime data table
Operational overview of out put value: - The out put value feature works in two phases
Pre-Execution Phase While –Execution Phase
1.Pre-Execution phase: It will capture the field name from which it need to
capture the value It will generate the corresponding script 2.While-Execution phase: Captures the actual value from the field Stores it under a specified column in the run time data
table
4.OUT PUT VALUE: -
Types of Out Put Values:There are five types of out put values…1.Standard Out Put Value: - It is used for capturing
property value of a standard GUI object2.Text Out Put Value: - It is used for capturing the text
present on a specified object3.Text-Area Out Put Value: - It is used for capturing
the Text present in a specified area4.Data Base Out Put Value: - It is used for capturing a
value from the database5.XML Out put Value: - It is used for capturing a value
from the XML file
4.OUT PUT VALUE: -
Navigation for Standard Out put value through application:Keep the cursor in the desired locationKeep the tool under recording modeActivate the menu item insertGo to out put valueSelect the option standard out put valueClick on the desired object in the AUTClick on OKSelect the desired property to be capturedClick on modifySpecify the desired column nameClick on OkOnce again click on okStop recording Navigation For standard check point through Active Screen Keep the cursor under the desired locationClick on active screenRight click on desired locationClick on insert output valueClick on okSelect the desired propertyClick on modifySpecify the desired column nameClick on okOnce again click on ok.
4.OUT PUT VALUE: -
It is a concept introduced in QTP which is used for calculating the time taken by an application to perform a specific task or the execution time of a block of statement
To do the same QTP has provided two options1.Start transaction2.End transactionNavigation for inserting transaction points:Keep the cursor in the desired locationActivate the menu item insertSelect the option start transactionSpecify the transaction nameSelect one of the following option
Before currant step After currant step
Click on ok
5.INSERTING THE TRANSACTION POINTS FOR MEASURING THE
TRANSACTION: -
To avoid the above navigation one can directly type the following statements manually in the desired location
INSERTING THE TRANSACTION POINTS
Services.start transaction ”transaction name”
-----------------------------------
-----------------------------------
-----------------------------------Services.end transaction ”transaction name”
There are five types of programmatic statements in the V.B script
1.Normal statements (or) Object calls2.Conditional statements3.Looping statements4.Comments5.Utility statements
6. INSERTING THE PROGRAMMATIC STATEMENTS: -
It is used for reporting an user defined message to the result window
SYNTAX: Reporter.reportevent status,”object name”,”message”
Example:Reporter.reporevent micdone,”my report”,”add button is working fine”.
REPORTER UTILITY OBJECT: -
Debugging: is a process of executing the script or a program in a user desired passion with some temporary breaks in order to identify the errors
To do the same QTP has provided step commands and break point feature.
Step commands: -There are three step commands1.Step into2.Step Out3.Step over
IV. DEBUGGING THE TEST:
1.Step into: Step into is used for executing a single statement then it will step in to the function or action and stops the execution.2.Step Out: Step out is used for executing all the remaining statements from the position of pointer in the function of the action and comes out of the function or action and stops execution 3.Step Over: Step over is used for executing the single statement if that statement is a function call or action call then it will execute all the statements in side the function or action once and stops the execution
IV. DEBUGGING THE TEST:
Break Point:Break point is the feature provided by QTP, which is used for breaking the execution temporarily
Navigation:• Activate the menu item debug• Select the desired option Example
Function my func( )Msg box “Hai”Msg box “hellow”Msg box “How r u”End function
My funcMsg box “bye”My funcMsg box”see u”My funcMsg “welcome”
IV. DEBUGGING THE TEST:
Debug viewer pane is used for viewing, modifying or setting the currant value of the variables or expressions during the execution break with the help of three tabs by name
1.watch expressions2.Variables3.Command Dim A Dim B Dim C
A=10 B=20 C="Test" msgbox A msgbox B msgbox C
DEBUG VIEWER PANE:
V. Executing the Test:In this phase one will execute the test
V. EXECUTING THE TEST:
VI. Analyzing the results: In this phase one will analyze the results..
*********End Of QTP Life Cycle**********************
VI. ANALYZING THE RESULTS:
Regular Expressions: -When ever the QTP is unable to identify the objects due to the regular changes
in the objects properties values dynamically during the execution then to overcome this problem one need to replace the corresponding property value in the object repository with a suitable regular expression
Navigation: Open the object repository Select the desired object in the object hierarchy Select the desired property in the properties list Click on the constant value options button Replace the constant value with suitable regular expression Select the check box regular expression Click on ok Click on ok
ADVANCED CONCEPTS
The variables that may be varied in different environments and need to be used in the multiple scripts, should not be directly used in the scripts. They need to be declare separately in an environment file that file need to be associated to the test and then the variables in that file need to be used in those test so that when ever the values need to be updated in different environments one can update them very easily in the environment
ENVIRONMENT VARIABLES:
So all the tests using those variables will be automatically updated such kind of variables separately declared in the environment file are known as environment variables
There are two types of environment variables1.Built in variables2.User defined variables
ENVIRONMENT VARIABLES:
1.Built in variables:These variables will be by default available with all the
tests so that on can directly use them in any test with the following syntax
SYNTAX: environment.value(“built invariable name”)Example: var = environment.value(“05”) Msg box var
ENVIRONMENT VARIABLES:
2.User defined variables: These variables need to e declared by us according tour need and
need to be stored in a separate environment file. Whenever required one need to associate these files to the currant test and use those variables
Navigation for creating an environment file with environment
variables: Activate the menu item File Select the option settings Select the environment tab Select the variable type as user defined Click on new Specify the variable name and the value Click on ok Click on export Browse the desired location Specify the desired file name with .XML extension Click on save
ENVIRONMENT VARIABLES:
To avoid the above navigation one can directly develop the XML file as follows• <environment>• <variable>• <name> flight path </name>• <value>”d:\program files\mercury” </value>• </variable>• <variable>• <name> b </name>• <value>203</value>• </variable>• </environment>• Navigation for associating an environment file to the currant test: Activate the menu item test Select the option settings Select the environment tab Select the variable types as user defined Select the check box load variables and value from ecternal files Browse the path of the environment file Click on apply and ok In order to avoid the above navigation one can directly type the following script statement in the starting of
the script Syntax: environment. Load from file “path of the env file” Example: environment. Load from file”d:\envfile122.xml” invoke application environment. Value(“flight Path”)
ENVIRONMENT VARIABLES:
Batch Testing Or Batch execution:-Executing a group of script files at a time is known as batch execution. To do the same QTP has provided a special tool by name test batch runner
Before using the test batch runner one need to do the following settings in QTP
Activate the menu item tools Select the opt option Select the run tab Select the check box allow other mercury products to run tests and
components Click on ok Navigation for test batch runner: Start ProgramsQuick test ProfessionalToolsTest batch runner Once the test batch runner is opened add all the desired script files and save
it as a batch file with .mtb extension When ever required open the batch file and execute it
Batch Testing Or Batch execution:
During the execution QTP may face some problematic situation where in it needs to recover by itself and continue the execution. To do the same a test engineer would have defined a solution well in advance and made it available to the currant test before starting the execution.
QTP may face four types of problematic situations1. Problems related to pop-up window
2. Problems related to object state
3. Problems related to test execution
4. Problems related to application crashTo define the solution for the above problems QTP has provided four trigger events
1. Pop up window
2. Object state
3. Test run error
4. Application crash
Recovery Scenarios:
During the execution QTP may face some problematic situation where in it needs to recover by itself and continue the execution. To do the same a test engineer would have defined a solution well in advance and made it available to the currant test before starting the execution.
Activate the menu item tools Select the option recovery scenario manager Click on new scenario button Click on next Select the trigger event as object state Click on next Click on next Click on the hand icon Click on the desired object in the AUT Click on ok Click on next Specify the desired properties with the help of add/remove button Click on next Once again click on next Select the recovery operation as function call Click on next Browse the desired library file Select the option define new function Specify the desired function name Write the body of the function Click on next Deselect the check box add another recovery operation Click on next Specify the desired scenario name Click on next Select the desired check boxes
Add scenario to the currant test Ass scenario to default test settings
Click on finish Click on save Browse the desired location and save the file by specifying a file name with .QRS extension Click on close
Recovery Scenarios: Navigation for object test:
Virtual object configuration is a process of making the QTP treat a specified area or an user defined object as a specific object
Navigation: Activate the menu item tools Go to virtual objects Select the option new virtual object Click on next Specify the desired class(type) of the object Click on next Mark the area in the application with the help of mark object button Click on next Select one of the following options
Entire parent hierarchy Parent only
Click on next Specify the desired object name Specify the desired collection name Click on finish
Virtual object configuration:
Virtual object manager is a feature provided by QTP which is used for creating and managing the virtual objects
Once a virtual object is created it will be available to all the tests unless until we delete it.
Virtual object manager:
Framework is a generic work (outline work) or a set of guidelines designed by an expert to perform a task in an effective, efficient and optimized way
Types of frame works: - (Mainly)
1) Linear frame work2) Modular frame work3) Key-word driven frame work4) Hybrid frame work5) Data frame work
Framework:
1. Linear Framework Generate the basic test Enhance the test Debug the test Execute the test Analyze the test
Framework:
2. Modular Framework:Develop the individual components for each and every
taskMake them as reusable componentsPrepare the required drivers based on the end to end
scenariosExecute the driversAnalyze the result
Framework:
2. Modular Framework:ACTIONS: Action is a set of script statements used for
performing a specific taskTypes of Actions:There are three types of actions1. Normal actions2. Re-usable actions3. External actions
Note: External actions are not editable .The re-usable actions called in another test are known as external actions
Actions
Navigation for inserting a new action:ACTIONS: Action is a set of script statements used for
performing a specific taskActivate the menu item insertSelect the option call to new actionRename the desired actionSelect the one of the following options
At the end of the test After the currant step
Click on ok
Operations On Actions:
Navigation for splitting an action in to two actions:Save the actionKeep the cursor on the first statement of the second
pathActivate the menu item stepSelect the option split actionSelect one of the following options
Independent of each other Nested
Specify the desired action name Click on ok
Operations On Actions:
Navigation for making an action as reusable action:Select the desired actionActivate the menu item stepSelect the option action propertiesSelect the check box reusable actionClick on ok
Operations On Actions:
Navigation for renaming the action:Activate the menu item InsertSelect the option action propertiesSpecify the desired nameClick on ok
Operations On Actions:
Navigation for calling on existing action:Activate the menu item insertSelect the option call to existing actionBrowse the desired testSelect the desired actionSelect one of the following options
At the end of the test After the currant step
Click on ok
Operations On Actions:
Create the folder structure as follows Crate the required test data file and save them in the corresponding folders Create the required shared repository files and save them in the
corresponding folder Create the required library files and save them in the corresponding folder Create the required environment files and save them in the corresponding
folder Create the required recovery files and save them in the corresponding folder Open the main test and associate all the required files to each Develop the script in such a weather it executes based on the key words
specified in the data table
Key word driven framework:
Example:Var= data table.Value(“keys”,1)Select case varCase “L1”Login( )Ins ord( )Logout( )Case”L2”Openord( )Logout( )Case “L3”Login( )Logout( )End select
Specify the desired key words under the corresponding column in the data table and save the test in the corresponding folder
When ever required open the test and execute it and analyze the result
Key word driven framework:
Hybrid frame work is a mixer of two or more frame works. * Library file is a collection of one or more functions
4. HYBRID FRAME WORK:
First method – Capture bitmap: It is used for capturing a snap shot of an object or an window during executin and stores it in the
desired locationSyntax: Object hierarchy.capturebitmap “Path of the location with a file name.bmpextension”Example: Window(“flight Reservation”).dailog(“openorder”).winbutton(“ok”).capturebitmap”D:\fl_automation\
b1.bmp” Second Method- Exist method:It is used for checking the objects existence if the object is existing then it will return a value True,
and make the QTP to continue the execution, If at all the object is not existing it will make the tool to wait till object exists. Once the object exists it will return true and make the QTP to continue the execution. If at all the object is not existing up to the maximum time then it will return false and make the QTP to continue the execution
Syntax: variable=object hierarchy.exists(time in seconds)Example: Var= window(“flight reservation”).exists(12)Wait property:Wait property is used for making the tool to wait based on the object properties valueSyntax: object hierarchy.wait property “property name”, property value, extra time in mille secondsWait: it is used for making the tool to wait till the specified time is elapsed.Syntax: Wait” Time in seconds”Simple and regularly used methods: -
The first method among those is click method.
Methods
Wait property: Wait property is used for making the tool to wait based on the object properties value Syntax: object hierarchy.wait property “property name”, property value, extra time in mille
seconds Wait: it is used for making the tool to wait till the specified time is elapsed. Syntax: Wait” Time in seconds” Simple and regularly used methods: - The first method among those is click method. 1. Click method: - Click method is used for clicking on specified object Syntax: Object hierarchy.click(x,y,[button] ) 2. Double click: - It is used for double clicking on a specified object Syntax: Object hirerarchy.dblclick(x,y, [button]) 3. Set Method: - Set method is used for setting a value in to an edit box or selecting or
deselecting acheck box or selecting a radio button Syntax: Object hirerearchy.set”value” Object hierarchy of check box.set “on/off” Object hierarchy of radiobutton.set
Methods
First method – Capture bitmap: Select Method: Select method is used for selecting an item in a combo box or a list box Syntax:Object hierarchy.select”item name” Activate Method: It is used for activating a window or a dialog. Syntax: Object hierarchy. Activate Close Method: It is used for closing the window or a browser Syntax: Object hierarchy. Close Set Secure: Set secure method is used for setting an encrypted data in to an
edit box Type Method: Type method is used for performing any kind of key board
related operation Syntax: Object hierarchy. Type key value Example: Dialog (“login”). Winedit(“agent name”).type mic tab
Methods
Descriptive Programming: -If at all the objects description is specified in the
program itself then that type of programming is known as descriptive programming
systemutil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("text:=login","width:=320").WinEdit("attached text:=Agent Name:","x:=20","y:=66").Set "Vijay"
Dialog("text:=login","width:=320").WinEdit("attached text:=Password:").Set "mercury" Dialog("text:=login","width:=320").WinButton("text:=OK").Click
DESCRIPTIVE PROGRAMMING
Data table methods:Data table methods are used for performing the operations on the runtime data table
1. Add- sheet: It is used for adding the new sheet for the runtime data table
SYNTAX: Data table.add sheet”sheet name”2. Delete- sheet: It is used for deleting a specified sheet from the run time data table
SYNTAX: Data table.delete sheet”sheet name”1033.Import: It is used for importing the data present in all the sheets in an excel file to
the runtime data tableSYNTAX: Data table.import ”path of the excel file”
4. Import Sheet: It is used for importing specified sheet of data from the excel file to the specified sheet in the runtime data tableSYNTAX: Data table. Import sheet “path of the excel file, source sheet id, destination sheet id”
5. Export: It is used for exporting the complete data present in the run time data table to a specified locationSYNTAX: Data table. export “Path of the location with a file name.xls extension
6. Export Sheet: It is used for exporting the data present in a specified sheet in the run
time data table to a specified locationSYNTAX: Data table .export sheet “path of the location with a file name.xls extension”, sheet id to be exported.
DATA TABLE METHODS
7. Set currant row: It is used for making the QTP focus on a specified rowSYNTAX: Data table. Set currant row (row number)
8. Set next row: It is used for making the QTP focused on the next of the currently focused row
SYNTAX: Data table. Set next row 9. Set Prev Row: It is used for making the QTP focus on the previous row of the currently focused tow
SYNTAX: Data table. Set prev row 10. Value Method: It is used for getting a value from a specified sheet, specified column and currently
focused row.SYNTAX: Variable= Data Table. Value ( “column name”, sheet id)
11. Get Sheet: It is used for making the QTP to focus on a specified sheet
SYNTAX: Data table. Get sheet (sheet id) 12. Get Row Count: It is used for getting the row count of a global sheet
If at all one wants to get the row count of a specified sheet first of all they need to make the QTP to focus on a specified sheet and then get the row count
SYNTAX 1: Variable= Data Table. Get row countSYNTAX 2: Variable= Data Table. Get sheet (“sheet id”). Get row count
Methods
GetRoProperty:It is used for getting the currant value of the runtime objects propertySyntax: Variable=Object hierarchy.getroproperty(“property name”)
Gettoproperty:- is used for getting the text objects properties value
SYNTAX: var= object hierarchy.gettoproperty (“property name”)Example: var= vbwindow9”form1”).vbbutton(“add”).gettopropery(“text”)
Note: Text objects property means the properties present in the object repository+properties present
in the secret place
Set to property:-Settoproperty Is used for setting the text objects properties value temporarily during the executionSYNTAX: Object hierarchy.settoproperty “property name”,”property value”
K=Dialog("Login").WinButton("OK").GetTOProperty("text")
msgbox K
Dialog("Login").WinButton("OK").SetTOProperty "text", "Yes"
R=Dialog("Login").WinButton("OK").GetTOProperty("text")
msgbox R
PROPERTIES:
Automation Object Model Automation object model: (AOM)
Automation object model is a concept provided to automate the operations on QTP through scripting
Dim qtappDim qttest
Set qtapp=createobject("QuickTest.Application")qtapp.launchqtapp.visible="true"qtapp.open "C:\Documents and Settings\Adith\Desktop\OpenOrder\
open", "true"Set qttest=qtapp.testqttest.runqttest.closeqtapp.quit
AUTOMATION OBJECT MODEL
Dim con, rsSet con = createobject("adodb.connection")Set rs= createobject("adodb.recordset")M.S Access Connection:Con.provider= ("microsoft.jet.oledb.4.0")Oracle connection:Con .open “provider =oraoledb.1;server=local
host;uid=scott;pwd=tiger;database=testdata;”SQLServer connection:Con.open “provider= sqloledb.1; server=local host;
uid=sa; pwd=; database= test data;”
DATA BASE CONNECTION
Ex: DB Connection of MSAccessDim con, rsSet con = createobject("adodb.connection")Set rs= createobject("adodb.recordset")con.provider=("Microsoft.ACE.OLEDB.12.0")con.open "C:\Program Files\HP\QuickTest Professional\
samples\flight\app\flight32.mdb"
DATA BASE CONNECTION
Conditional statements are used to perform different actions for different decisions.
In VBScript we have four conditional statements:If statement - executes a set of code when a condition is
trueIf...Then...Else statement - select one of two sets of lines
to executeIf...Then...ElseIf statement - select one of many sets of
lines to executeSelect Case statement - select one of many sets of lines to
execute
DATA BASE CONNECTION
Conditional Statements
Conditional statements are used to perform different actions for different
decisions.In VBScript we have four conditional
statements:If statement - executes a set of code
when a condition is trueIf...Then...Else statement - select one
of two sets of lines to executeIf...Then...ElseIf statement - select one
of many sets of lines to executeSelect Case statement - select one of
many sets of lines to execute
VBSCRIPT ARRAY VARIABLES
An array variable is used to store multiple values in a single variable.
In the following example, an array containing 3 elements is declared:
Ex: Dim names(2)The number shown in the parentheses is 2. We start at zero
so this array contains 3 elements. This is a fixed-size array. You assign data to each of the elements of the array like this:
names(0)="Tove"names(1)="Jani"names(2)="Stale"