What is descriptive programming (Programmatic Description) in QTP
Solution 1
Creating a test without using the object repository is known as descriptive programming since you describe the objects as part of the script.
e.g.
Browser("title:=Google").Page("title:=Google").Link("text:=Advanced Search").Click
Note the :=
in the test objects' names, this is not a smiley it means that the property title
has value Google
(as a regular expression).
You can also use the Description
object via Description.Create
.
You can see more details here.
Solution 2
descriptive programming is writing qtp scpriting without any object repository
Solution 3
Descriptive programming is used when you want to perform an operation on an object that is not present in the object repository.
Setting the value of a Text Box
Browser(“Browser”).Page(“Page”).WebEdit(“Name:=textbox_name”,”html tag:=INPUT”).set “My New value”
Read More
Check out this extensive article about the topic
http://www.learnqtp.com/descriptive-programming-simplified/
Solution 4
Descriptive programming is used in many scenarios like
- When QTP is not able to identify objects from properties value stored in Object Repository.
- When user do not want to use object repository or bypass it.
- When user wants to write a piece of code that can run on more than one website. For eg.when we want to print the name of all link on Google or yahoo, we can use same piece of code using common property value
It is used in two ways:
Static Descriptive programming
Here we use properties and values directly in test script to access an object. For eg.
Browser("micClass:=.....").Page("micClass:=...").Link("micClass:=...")
Note: We can start Descriptive programming at any time, but once started we can not use Object Repository till the line is finished.
Dynamic Descriptive programming
Here we create a description object and then operate on that. For eg.
Set objTest = Description.Create objTest("micClass").Value = "Link" objTest("name").value = "Click Here"
Admin
Updated on March 25, 2021Comments
-
Admin over 3 years
What is descriptive programming in QTP?
-
TheBlastOne almost 14 yearsLet's add that it descriptive programming is useful whenever you want to address an object whose identification attributes' values vary, and which cannot be described efficiently using a regular expression. And: Since QTP began to support parametrized identification properties (i.e. the attribute value is not a literal, but a parameter placeholder replaced by the parameter's value at run-time) (in 9? or 10?), you do not have to depend on descriptive programming as often as earlier when this feature didn' exist.
-
MasterJoe about 7 years@TheBlastOne - How do you check if a web element exists when using dynamic descriptive programming ? In static, its .WebElement(properties).Exist(time).
-
TheBlastOne about 7 yearsWhy don´t you post this as a question? (I use .ChildObjects with the parent object, and check if the result collection has 1 item.)