What is descriptive programming (Programmatic Desc

2019-02-18 13:03发布

问题:

What is descriptive programming in QTP?

回答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.



回答2:

descriptive programming is writing qtp scpriting without any object repository



回答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/



回答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 1. 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.
  1. 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"

Regards Dheeraj

Mindfire Solutions, India



回答5:

Descriptive programming is used when we want to perform an operation on an object that is not stored in the object repository. This way QTP won’t search for the object properties in the Object Repository, but will take it from the statement.



回答6:

The Description of objects like properties and values that we are specifying directly in the test script is called descriptive program Mainly we can use descriptive program without using object repository.



回答7:

Using Descriptive programming we can define an objects in the QTP without using the OR (object repository) Here is a good tutorial that describes three ways to do descriptive programming: http://www.bytetips.com/descriptive-programming-in-qtp/



回答8:

Browser("title:=Google").Page("title:=Google").Link("text:=Advanced Search").Click is not a Descriptive programming, it is bad practise. Parameters should be separated from code, so you change them in 1 place, Object Repository file in this case.

What is Descriptive programming - when you use Description object:

Dim oDesc        'Description Object
Dim colObject    'Object Collection

Set oDesc = Description.Create
oDesc( "micclass" ).value = "Link"
oDesc( "text" ).value = ".*ma.*"  'Images
oDesc( "text" ).regularExpression = False

Set colObject = Browser( "Google").Page("Google").ChildObjects( oDesc )

So idea is to use description to get collection and search for your element in that collection.



回答9:

What I can say about descriptive Programming is We use Descriptive Programming when we don't want to use Object Repository. Many people said they used descriptive Programming in agile development mode, in which they start creating automation scripts while application was still in development (in agile mode).

We use descriptive programming, when some objects are dynamically changes object properties and with given set of assertive properties it is difficult to identify object,without compromising script performance.



回答10:

Identifying the objects in your page without Object Repository with special property The most used for Descriptive objects when you have more than one object in the same page with same E.g. HTML ID and you need to click on all of it ... you can return all objects and making loop to click on the object that you identify in object script with it's property(s)



回答11:

Aside from all the repetition above, I would say that it's the best and most lightweight way to work with QTP, vbscript is the easiest of languages and even considering that, you are only going to be using a small portion of it.

Also re. descriptive programming, there is static descriptive programming, and Dynamic descriptive. Static is creating a variable for each object you want to identify/interact with (ie. dim myBUTTON ) and then giving descriptions of that actual button to the variable.

It's fine and functional, but as Artem pointed out above, the Dynamic version (which he shows you in perfect code) is far more reuseable and friendly and better looking in terms of keeping your code tidier. You make one description object, and continuously redefine6 it for the various needs you have, so (using Artems naming convention) oDesc can become a button that you click, a link that you click, and you can keep redefining it as you go down your code (by giving the same properties/values to that object). It's tidier, and you don't have a million variable names flying all over the place so it's clearer. Dynamic descriptive programming ! There's some fine-aspects to it and trouble shooting depending on which values you pass to your object, so feel free to contact me anytime, Y.



回答12:

In Simple words we can say Describing the object via Code, Instead of Object repository.

Sample Code

Browser("title:=Google").Page("title:=Google").Link("text:=Advanced Search").Click

Object Based Code

Browser("Google").Page("Google").Link("Advanced Search").Click

And you Need object for all



回答13:

Descriptive Programming is used to perform operations on the object which we are not present in qtp.It uses [Property ->value]. Please refer below link:-

Descriptive Programming Simplified



回答14:

Think of it as finding a location (like finding the object), object repository works as a map app (e.g., Google map), you just have to give the recorded location and it will find it for you.

Descriptive programming is basically you understand the object and its elements. It means you know way to go home or at least have a map with you in order to find the location.

Both have pros and cons. Say if your phone is dead, or there's no network, Google maps (object repository) won't work for you anymore. You have to go with a native way.



回答15:

"Descriptive Programming" is a misnomer.

It's used, very misleadingly, as a synonym for 'Dynamic Object Recognition'.



回答16:

Writing descriptive level programming for the qtp



标签: qtp hp-uft