什么是QTP中的描述性编程(Programmatic Description)

发布于 2024-08-25 09:17:04 字数 21 浏览 3 评论 0原文

QTP中的描述性编程是什么?

What is descriptive programming in QTP?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(17

悲凉≈ 2024-09-01 09:17:05

描述性编程是在没有任何对象存储库的情况下编写 qtp scpriting

descriptive programming is writing qtp scpriting without any object repository

野生奥特曼 2024-09-01 09:17:05

描述性编程用于以下情况:
你想要执行一个操作
中不存在的对象
对象存储库。

设置文本框的值

Browser(“Browser”).Page(“Page”).WebEdit(“Name:=textbox_name”,”html tag:=INPUT”).set “My New value”

了解更多
查看有关该主题的这篇内容广泛的文章
http://www.learnqtp.com/descriptive-programming-simplified/

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/

满栀 2024-09-01 09:17:05

描述性编程用于许多场景,例如

  • 当 QTP 无法从对象存储库中存储的属性值识别对象时。
  • 当用户不想使用对象存储库或绕过它时。
  • 当用户想要编写一段可以在多个网站上运行的代码时。例如,当我们想要打印 Google 或 yahoo 上所有链接的名称时,我们可以使用公共属性值使用相同的代码

它有两种使用方式:

  1. 静态描述性编程

    这里我们直接在测试脚本中使用属性和值来访问对象。例如。

    浏览器("micClass:=.....").Page("micClass:=...").Link("micClass:=...")
    

    注意:我们可以随时开始描述性编程,但是一旦开始,我们就无法使用对象存储库,直到该行完成。

  2. 动态描述性编程

    这里我们创建一个描述对象,然后对其进行操作。例如。

    设置 objTest = Description.Create
    objTest("micClass").Value = "链接"
    objTest("名称").value = "点击此处"
    

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.

  2. 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"
    
美人如玉 2024-09-01 09:17:05

当我们想要对未存储在对象存储库中的对象执行操作时,会使用描述性编程。这样QTP就不会在对象存储库中搜索对象属性,而是从语句中获取它。

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.

标点 2024-09-01 09:17:05

我们在测试脚本中直接指定的对象(例如属性和值)的描述称为描述性程序
主要是我们可以使用描述性程序而不使用对象存储库。

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.

屋顶上的小猫咪 2024-09-01 09:17:05

使用描述性编程,我们可以在 QTP 中定义对象,而无需使用 OR(对象存储库)。这是一个很好的教程,描述了进行描述性编程的三种方法:http://www.bytetips.com/descriptive-programming-in-qtp/

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/

兔姬 2024-09-01 09:17:05

Browser("title:=Google").Page("title:=Google").Link("text:=高级搜索").Click
不是描述性编程,这是不好的做法。
参数应与代码分开,因此您可以在一处更改它们,在本例中是对象存储库文件。

什么是描述性编程 - 当您使用描述对象时:

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 )

所以想法是使用描述来获取集合并在该集合中搜索元素。

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.

甜味超标? 2024-09-01 09:17:05

关于描述性编程,我可以说的是,当我们不想使用对象存储库时,我们可以使用描述性编程。许多人表示,他们在敏捷开发模式中使用了描述性编程,在应用程序仍在开发中(敏捷模式)时,他们就开始创建自动化脚本。

我们使用描述性编程,当某些对象动态更改对象属性并且使用给定的一组断言属性时,很难在不影响脚本性能的情况下识别对象。

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.

魂归处 2024-09-01 09:17:05

在没有具有特殊属性的对象存储库的情况下识别页面中的对象
最常用于描述性对象,当您在同一页面中有多个具有相同(例如 HTML ID)的对象并且您需要单击所有对象时...您可以返回所有对象并进行循环以单击您标识的对象在对象脚本中及其属性

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)

独木成林 2024-09-01 09:17:05

除了上面的所有重复之外,我想说它是使用 QTP 的最佳和最轻量级的方式,vbscript 是最简单的语言,即使考虑到这一点,您也只会使用其中的一小部分。

还重新。描述性编程,有静态描述性编程和动态描述性编程。静态是为您想要识别/交互的每个对象创建一个变量(即变暗 myBUTTON ),然后向该变量提供该实际按钮的描述。

它很好而且功能齐全,但正如 Artem 上面指出的那样,动态版本(他以完美的代码向您展示了)在保持代码整洁方面更具可重用性和友好性,并且外观更好。你创建一个描述对象,并​​根据你的各种需求不断地重新定义它,因此(使用 Artems 命名约定)oDesc 可以成为你单击的一个按钮、一个你单击的链接,并且你可以在你继续往下看时不断地重新定义它。代码(通过为该对象提供相同的属性/值)。它更整洁,而且没有一百万个变量名称到处乱飞,所以更清晰。动态描述性编程!它有一些好的方面和故障排除,具体取决于您传递给对象的值,所以请随时与我联系,
Y。

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.

羁客 2024-09-01 09:17:05

简而言之,我们可以说通过代码描述对象,而不是对象存储库。

示例代码

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

基于对象的代码

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

并且您需要所有对象

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

还在原地等你 2024-09-01 09:17:05

描述性编程用于对qtp中不存在的对象执行操作。它使用[属性->值]。
请参考以下链接:-

简化描述性编程

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

め七分饶幸 2024-09-01 09:17:05

将其视为查找位置(就像查找对象),对象存储库充当地图应用程序(例如,谷歌地图),您只需提供记录的位置,它就会为您找到它。

描述性编程基本上是让你了解对象及其元素。这意味着您知道回家的路,或者至少随身携带地图以便找到回家的位置。

两者都有优点和缺点。假设如果你的手机没电了,或者没有网络,谷歌地图(对象存储库)将不再为你工作。你必须采用本土方式。

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.

不…忘初心 2024-09-01 09:17:05

描述性编程用于完全避免使用对象存储库或避免在对象存储库中添加类似类型的对象。要了解描述性编程的所有可能用法以及示例,请参阅 https:// myskillpoint.com/descriptive-programming-in-uft-with-examples/

Descriptive programming is used to completely avoid the use of an object repository or avoid adding similar kinds of objects in the object repository. To understand all possible uses of descriptive programming with examples please refer to https://myskillpoint.com/descriptive-programming-in-uft-with-examples/

长不大的小祸害 2024-09-01 09:17:05

“描述性编程”是一个用词不当。

它被用作“动态对象识别”的同义词,非常具有误导性。

"Descriptive Programming" is a misnomer.

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

探春 2024-09-01 09:17:05

为qtp编写描述性级别编程

Writing descriptive level programming for the qtp

唠甜嗑 2024-09-01 09:17:04

不使用对象存储库创建测试称为描述性编程,因为您将对象描述为脚本的一部分。

例如,

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

请注意测试对象名称中的 :=,这不是一个笑脸,它意味着属性 title 具有值 Google (作为正则表达式)。

您还可以通过 Description.Create 使用 Description 对象。

您可以在此处查看更多详细信息。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文