SlideShare a Scribd company logo
QTP	
  Descriptive	
  programming	
  Tutorial	
  
http://www.bytetips.com/descriptive-­‐programming-­‐in-­‐qtp/	
  
What is descriptive programming in QTP? How to do descriptive programming? Those are some common
question QTP (Hp QuickTest Pro) users. Descriptive programming is a way for QTP to bypass Object
Repository (OR). In this tutorial i will show how to do Descriptive programming. If we want to perform an
operation on an object that is not stored in the object repository then we use Descriptive programming.
Here are some advantages of using descriptive programing:
1. Descriptive Programming based Test Scripts run on any Machine easily.
2.Test scripts runs faster than OR based scripts.
3.Easy Maintenance because it doesn't depend on Object Repository.
There are different ways to create descriptive programing in QTP. Follow rest of the tutorial to find out
more about Descriptive Programing:
First way to do Descriptive Programming in QTP:
Example Using Google Search
Step 1: At first we are going to run Internet Explorer. In QTP we use systemutil.Run command to run any
program. To do so the syntax will be:
systemutil.Run "The program we want to run", "the website Address"
Example for opening www.google.com
systemutil.Run "iexplore.exe", "www.google.com"
Step 2: Now we are going to declare variable for this example we are using :
googleSearchText = For the the google search text box.
googleSearchBtn = For Google search button description.
anyPage = For Describing a browser and page.
For Example:
Dim googleSearchText,googleSearchBtn,anyPage
Step 3: Then We are going to initialize the anyPage variable. We are going to set it to run on any page.
Look at the code below:
Set anyPage = Browser("micclass:=Browser").Page("micclass:=Page")
The purpose of initializing this into variable is to shortening the code.
Step 4: In this step we are going create and describe the objects. Using QTP Object Spy you can get object
Properties. It shows the types and properties of an object. Here is what object spy looks like.
	
  
QTP	
  Descriptive	
  programming	
  Tutorial	
  
http://www.bytetips.com/descriptive-­‐programming-­‐in-­‐qtp/	
  
It's possible to get these properties :Syntax for creating and describing object in QTP :
Set Variable_Name = Description.Create Variable_Name("property").value
= "properties from APP" Variable_Name("property").value = "properties
from APP"
Here is an example for describing googleSearchText,googleSearchBtn :
Set googleSearchText = Description.Create
googleSearchText("micclass").value = "WebEdit"
googleSearchText("type").value = "text" googleSearchText("name").value
= "q" Set googleSearchBtn = Description.Create
googleSearchBtn("micclass").value = "WebButton"
googleSearchBtn("name").value = "Google Search"
Step 5: Now we are going to put all the created objects together to use it. So far we created a Any page
object, Google search text box and Google Search button. To use all the object together the syntax is:
anyPage.Type of object(Object Name).command "what we want to search"
Example
anyPage.WebEdit(googleSearchText).Set "Bytetips QTP Tutorial"
This is the Final script we created using descriptive programing. This script will start Internet Explorer and
navigate to Google and search for the text provided in the text field. You can copy-paste this script inside
qtp to see how this thing works.
QTP	
  Descriptive	
  programming	
  Tutorial	
  
http://www.bytetips.com/descriptive-­‐programming-­‐in-­‐qtp/	
  
systemutil.Run "iexplore.exe", "www.google.com" Dim
googleSearchText,googleSearchBtn,anyPage Set anyPage =
Browser("micclass:=Browser").Page("micclass:=Page") Set
googleSearchText = Description.Create
googleSearchText("micclass").value = "WebEdit"
googleSearchText("type").value = "text" googleSearchText("name").value
= "q" Set googleSearchBtn = Description.Create
googleSearchBtn("micclass").value = "WebButton"
googleSearchBtn("name").value = "Google Search"
anyPage.WebEdit(googleSearchText).Set "Bytetips QTP Tutorial"
anyPage.WebButton(googleSearchBtn).Click
Second way to do Descriptive Programming in QTP: The first way is a bit long process. We can do
inline descriptive programing to shorten the script.
Step 1: At first we are going to run Internet Explorer. In QTP we use systemutil.Run command to run any
program. To do so the syntax will be:
systemutil.Run "The program we want to run", "the website Address"
Example for opening www.google.com
systemutil.Run "iexplore.exe", "www.google.com"
Step 2: Now we are going to declare variable for this example we are using :
anyPage = For Describing a browser and page.
For Example:
Dim anyPage
Step 3: Then We are going to initialize the anyPage variable. We are going to set it to run on any page.
Look at the code below:
Set anyPage = Browser("micclass:=Browser").Page("micclass:=Page")
The purpose of initializing this into variable is to shortening the code.
Step 4: In this step we are going create and describe the objects. This time Syntax for creating and
describing object would be :
Page object.Type of object(Object Name).command "what we want to
search"
For Example :
anyPage.WebEdit("micclass:=WebEdit","name:=q","type:=text").Set
"Bytetips QTP Tutorial"
Step 5: Now we can put all our code together Look at the code below:
systemutil.Run "iexplore.exe", "www.google.com" Dim anyPage Set anyPage
= Browser("micclass:=Browser").Page("micclass:=Page")
anyPage.WebEdit("micclass:=WebEdit","name:=q","type:=text").Set
"Bytetips QTP Tutorial"
anyPage.WebButton("micclass:=WebButton","name:=Google Search").Click
QTP	
  Descriptive	
  programming	
  Tutorial	
  
http://www.bytetips.com/descriptive-­‐programming-­‐in-­‐qtp/	
  
Another way to make the script short
systemutil.Run "iexplore.exe", "www.google.com" Dim anyPage Set anyPage
= Browser("micclass:=Browser").Page("micclass:=Page") With anyPage
.WebEdit("micclass:=WebEdit","name:=q","type:=text").Set "Bytetips QTP
Tutorial" .WebButton("micclass:=WebButton","name:=Google Search").Click
End With
Second way to do Descriptive Programming in QTP: Here is another way to create object in QTP. This
time we are going to use Const and initialize the variable with object property.
systemutil.Run "iexplore.exe", "www.google.com" Const dpBrowser =
"micclass:=Browser" Const dpPage = "micclass:=Page" Const
googleSearchText= "name:=q" Const googleSearchBtn="name:=Google Search"
Browser(dpBrowser).Page(dpPage).webedit(googleSearchText).Set "Bytetips
QTP Tutorial"
Browser(dpBrowser).Page(dpPage).webButton(googleSearchBtn).Click
	
  

More Related Content

PDF
JavaScript OOPs
ODP
Object Oriented Javascript
PPTX
Object Oriented Programming In JavaScript
ODP
Adding To the Leaf Pile
PDF
Advanced JavaScript - Internship Presentation - Week6
PDF
Object Oriented Programming in JavaScript
ODP
JavaScript Object Oriented Programming Cheat Sheet
PPTX
JavaScript OOPs
Object Oriented Javascript
Object Oriented Programming In JavaScript
Adding To the Leaf Pile
Advanced JavaScript - Internship Presentation - Week6
Object Oriented Programming in JavaScript
JavaScript Object Oriented Programming Cheat Sheet

What's hot (20)

PDF
PDF
Reactive & Realtime Web Applications with TurboGears2
PPT
OOP in JavaScript
DOC
Qtp realtime scripts
PPT
Advanced Javascript
PPTX
Top 10 RxJs Operators in Angular
PPTX
Necto 16 training 20 component mode & java script
PPTX
Object Oriented JavaScript - II
ODP
Agile web development Groovy Grails with Netbeans
PPTX
PPTX
RxJS and Reactive Programming - Modern Web UI - May 2015
PPTX
Javascript basics for automation testing
PDF
Deep dive into Android async operations
PDF
TypeScript 2 in action
PPTX
27 - Panorama Necto 14 component mode & java script - visualization & data di...
PPTX
JavaScript Conditional Statements
PPTX
Introduction to JavaScript Programming
PDF
Promises look into the async future
ODP
Introduction of Object Oriented JavaScript
PPTX
Rethinking Best Practices
Reactive & Realtime Web Applications with TurboGears2
OOP in JavaScript
Qtp realtime scripts
Advanced Javascript
Top 10 RxJs Operators in Angular
Necto 16 training 20 component mode & java script
Object Oriented JavaScript - II
Agile web development Groovy Grails with Netbeans
RxJS and Reactive Programming - Modern Web UI - May 2015
Javascript basics for automation testing
Deep dive into Android async operations
TypeScript 2 in action
27 - Panorama Necto 14 component mode & java script - visualization & data di...
JavaScript Conditional Statements
Introduction to JavaScript Programming
Promises look into the async future
Introduction of Object Oriented JavaScript
Rethinking Best Practices
Ad

Viewers also liked (12)

DOC
Qtp material for beginners
DOC
Qtp+real time+test+script
PPTX
Uft ppt
PDF
Thomson reuters qtp training presentation
PPTX
Web service testing using QTP (UFT)
PDF
UFT & QTP Interview Unplugged 2nd Ed
PPTX
UFT Automation Framework Introduction
PDF
What is UFT? HP's unified functional testing.
PPTX
Uft Basics
PPT
Ppt Qtp
PPT
Qtp Basics
PPTX
Introduction to Unified Functional Testing 12 (UFT)
Qtp material for beginners
Qtp+real time+test+script
Uft ppt
Thomson reuters qtp training presentation
Web service testing using QTP (UFT)
UFT & QTP Interview Unplugged 2nd Ed
UFT Automation Framework Introduction
What is UFT? HP's unified functional testing.
Uft Basics
Ppt Qtp
Qtp Basics
Introduction to Unified Functional Testing 12 (UFT)
Ad

Similar to QTP Descriptive programming Tutorial (20)

DOC
Qtp faqs
DOC
Qtp stuff
DOC
Qtp basic stuff
DOC
Interview qutions
DOC
Qtp interview questions
DOC
Qtp interview questions
DOCX
QTP Interview Questions and answers
PPTX
13_User_Defined_Objects.pptx objects in javascript
DOCX
Qtp basic
PDF
Object-Oriented Python 1st Edition Irv Kalb
PDF
Angular 2 Crash Course
PPT
Eclipse UI automation
PPT
eXo SEA - JavaScript Introduction Training
PDF
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
PDF
Design patterns in javascript
PPT
Qtp Training Deepti 3 Of 44256
PPT
Qtp Training
PPTX
Prototype Object.pptx
PDF
OSMC 2021 | inspectIT Ocelot: Dynamic OpenTelemetry Instrumentation at Runtime
DOCX
Keyword driven testing in qtp
Qtp faqs
Qtp stuff
Qtp basic stuff
Interview qutions
Qtp interview questions
Qtp interview questions
QTP Interview Questions and answers
13_User_Defined_Objects.pptx objects in javascript
Qtp basic
Object-Oriented Python 1st Edition Irv Kalb
Angular 2 Crash Course
Eclipse UI automation
eXo SEA - JavaScript Introduction Training
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
Design patterns in javascript
Qtp Training Deepti 3 Of 44256
Qtp Training
Prototype Object.pptx
OSMC 2021 | inspectIT Ocelot: Dynamic OpenTelemetry Instrumentation at Runtime
Keyword driven testing in qtp

Recently uploaded (20)

PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
Cell Structure & Organelles in detailed.
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Cell Types and Its function , kingdom of life
PDF
RMMM.pdf make it easy to upload and study
PDF
Insiders guide to clinical Medicine.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Complications of Minimal Access Surgery at WLH
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Pre independence Education in Inndia.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
FourierSeries-QuestionsWithAnswers(Part-A).pdf
TR - Agricultural Crops Production NC III.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Anesthesia in Laparoscopic Surgery in India
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
VCE English Exam - Section C Student Revision Booklet
Cell Structure & Organelles in detailed.
Pharma ospi slides which help in ospi learning
Cell Types and Its function , kingdom of life
RMMM.pdf make it easy to upload and study
Insiders guide to clinical Medicine.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Complications of Minimal Access Surgery at WLH
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Renaissance Architecture: A Journey from Faith to Humanism
human mycosis Human fungal infections are called human mycosis..pptx
GDM (1) (1).pptx small presentation for students
Pre independence Education in Inndia.pdf

QTP Descriptive programming Tutorial

  • 1. QTP  Descriptive  programming  Tutorial   http://www.bytetips.com/descriptive-­‐programming-­‐in-­‐qtp/   What is descriptive programming in QTP? How to do descriptive programming? Those are some common question QTP (Hp QuickTest Pro) users. Descriptive programming is a way for QTP to bypass Object Repository (OR). In this tutorial i will show how to do Descriptive programming. If we want to perform an operation on an object that is not stored in the object repository then we use Descriptive programming. Here are some advantages of using descriptive programing: 1. Descriptive Programming based Test Scripts run on any Machine easily. 2.Test scripts runs faster than OR based scripts. 3.Easy Maintenance because it doesn't depend on Object Repository. There are different ways to create descriptive programing in QTP. Follow rest of the tutorial to find out more about Descriptive Programing: First way to do Descriptive Programming in QTP: Example Using Google Search Step 1: At first we are going to run Internet Explorer. In QTP we use systemutil.Run command to run any program. To do so the syntax will be: systemutil.Run "The program we want to run", "the website Address" Example for opening www.google.com systemutil.Run "iexplore.exe", "www.google.com" Step 2: Now we are going to declare variable for this example we are using : googleSearchText = For the the google search text box. googleSearchBtn = For Google search button description. anyPage = For Describing a browser and page. For Example: Dim googleSearchText,googleSearchBtn,anyPage Step 3: Then We are going to initialize the anyPage variable. We are going to set it to run on any page. Look at the code below: Set anyPage = Browser("micclass:=Browser").Page("micclass:=Page") The purpose of initializing this into variable is to shortening the code. Step 4: In this step we are going create and describe the objects. Using QTP Object Spy you can get object Properties. It shows the types and properties of an object. Here is what object spy looks like.  
  • 2. QTP  Descriptive  programming  Tutorial   http://www.bytetips.com/descriptive-­‐programming-­‐in-­‐qtp/   It's possible to get these properties :Syntax for creating and describing object in QTP : Set Variable_Name = Description.Create Variable_Name("property").value = "properties from APP" Variable_Name("property").value = "properties from APP" Here is an example for describing googleSearchText,googleSearchBtn : Set googleSearchText = Description.Create googleSearchText("micclass").value = "WebEdit" googleSearchText("type").value = "text" googleSearchText("name").value = "q" Set googleSearchBtn = Description.Create googleSearchBtn("micclass").value = "WebButton" googleSearchBtn("name").value = "Google Search" Step 5: Now we are going to put all the created objects together to use it. So far we created a Any page object, Google search text box and Google Search button. To use all the object together the syntax is: anyPage.Type of object(Object Name).command "what we want to search" Example anyPage.WebEdit(googleSearchText).Set "Bytetips QTP Tutorial" This is the Final script we created using descriptive programing. This script will start Internet Explorer and navigate to Google and search for the text provided in the text field. You can copy-paste this script inside qtp to see how this thing works.
  • 3. QTP  Descriptive  programming  Tutorial   http://www.bytetips.com/descriptive-­‐programming-­‐in-­‐qtp/   systemutil.Run "iexplore.exe", "www.google.com" Dim googleSearchText,googleSearchBtn,anyPage Set anyPage = Browser("micclass:=Browser").Page("micclass:=Page") Set googleSearchText = Description.Create googleSearchText("micclass").value = "WebEdit" googleSearchText("type").value = "text" googleSearchText("name").value = "q" Set googleSearchBtn = Description.Create googleSearchBtn("micclass").value = "WebButton" googleSearchBtn("name").value = "Google Search" anyPage.WebEdit(googleSearchText).Set "Bytetips QTP Tutorial" anyPage.WebButton(googleSearchBtn).Click Second way to do Descriptive Programming in QTP: The first way is a bit long process. We can do inline descriptive programing to shorten the script. Step 1: At first we are going to run Internet Explorer. In QTP we use systemutil.Run command to run any program. To do so the syntax will be: systemutil.Run "The program we want to run", "the website Address" Example for opening www.google.com systemutil.Run "iexplore.exe", "www.google.com" Step 2: Now we are going to declare variable for this example we are using : anyPage = For Describing a browser and page. For Example: Dim anyPage Step 3: Then We are going to initialize the anyPage variable. We are going to set it to run on any page. Look at the code below: Set anyPage = Browser("micclass:=Browser").Page("micclass:=Page") The purpose of initializing this into variable is to shortening the code. Step 4: In this step we are going create and describe the objects. This time Syntax for creating and describing object would be : Page object.Type of object(Object Name).command "what we want to search" For Example : anyPage.WebEdit("micclass:=WebEdit","name:=q","type:=text").Set "Bytetips QTP Tutorial" Step 5: Now we can put all our code together Look at the code below: systemutil.Run "iexplore.exe", "www.google.com" Dim anyPage Set anyPage = Browser("micclass:=Browser").Page("micclass:=Page") anyPage.WebEdit("micclass:=WebEdit","name:=q","type:=text").Set "Bytetips QTP Tutorial" anyPage.WebButton("micclass:=WebButton","name:=Google Search").Click
  • 4. QTP  Descriptive  programming  Tutorial   http://www.bytetips.com/descriptive-­‐programming-­‐in-­‐qtp/   Another way to make the script short systemutil.Run "iexplore.exe", "www.google.com" Dim anyPage Set anyPage = Browser("micclass:=Browser").Page("micclass:=Page") With anyPage .WebEdit("micclass:=WebEdit","name:=q","type:=text").Set "Bytetips QTP Tutorial" .WebButton("micclass:=WebButton","name:=Google Search").Click End With Second way to do Descriptive Programming in QTP: Here is another way to create object in QTP. This time we are going to use Const and initialize the variable with object property. systemutil.Run "iexplore.exe", "www.google.com" Const dpBrowser = "micclass:=Browser" Const dpPage = "micclass:=Page" Const googleSearchText= "name:=q" Const googleSearchBtn="name:=Google Search" Browser(dpBrowser).Page(dpPage).webedit(googleSearchText).Set "Bytetips QTP Tutorial" Browser(dpBrowser).Page(dpPage).webButton(googleSearchBtn).Click