你如何编写 QTP 测试?
我正在尝试使用 QTP 进行一些 webapp ui 自动化测试,我想知道人们通常如何编写 QTP 测试。您是否使用对象映射、描述性编程、组合或其他方式?任何小代码示例将不胜感激,谢谢
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我正在尝试使用 QTP 进行一些 webapp ui 自动化测试,我想知道人们通常如何编写 QTP 测试。您是否使用对象映射、描述性编程、组合或其他方式?任何小代码示例将不胜感激,谢谢
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
这是我的建议。
1) 构建您的测试自动化需求矩阵。
您可以使用我的博客
http://automation 中的示例-beyond.com/2009/06/06/qa-test-automation-requirements-usability/
http://automation-beyond.com/2009/06/07/qa-test-automation-requirements-usability-2/
http://automation-beyond.com/2009/06 /10/qa-test-automation-requirements-5-maintainability/
http://automation-beyond.com/2009/06/08/qa-test-automation-requirements-robustness/
http://automation-beyond.com/2009/06/09/qa-test-automation-requirements-scalability /
2) 选择您的自动化方法
3 )根据您选择的方法编写测试脚本
注意。 QTP Repository 方式或描述性编程属于前端功能测试自动化的 GUI 识别部分。它们在坚固性和维护方面很重要。
从技术上来说,几乎是一样的。在这两种情况下,您都应该很好地理解 GUI 识别概念,否则无论采用哪种方法都会遇到问题。
一个好的框架应该通过在对象引用级别操作来支持 GUI 映射和描述性编程符号。也就是说,您应该将对象识别和对象交互任务分开。
请注意,根据上下文,描述性编程符号可能减慢脚本的性能,并且它总是需要额外的维护工作,而在其他情况下,仅使用对象存储库可能会导致对象描述不必要的重复,或者可能会限制对动态更改的 GUI 的识别。
我在下面的文章中阐述了上面提出的一些观点:
一些 QTP 性能测试:对象存储库与描述性编程
直接代码示例(对于实际的自动化,我推荐 GUI 函数换行)。
描述性编程 - 通过物理描述属性来寻址对象。
通过映射的 GUI 名称来寻址对象
谢谢,
阿尔伯特·加里耶夫
http://automation-beyond.com/
Here's my suggestion.
1) Build your test automation requirements matrix.
You can use samples from my blog
http://automation-beyond.com/2009/06/06/qa-test-automation-requirements-usability/
http://automation-beyond.com/2009/06/07/qa-test-automation-requirements-usability-2/
http://automation-beyond.com/2009/06/10/qa-test-automation-requirements-5-maintainability/
http://automation-beyond.com/2009/06/08/qa-test-automation-requirements-robustness/
http://automation-beyond.com/2009/06/09/qa-test-automation-requirements-scalability/
2) Choose your automation approach
3) Write your testing scripts according to the approach you chose
Note. QTP Repository way or Descriptive Programming belong to GUI recognition part of front-end functional test automation. They matter in terms of robustness and maintenance.
Technically, it's nearly the same. In both cases you should understand GUI recognition concept well, or you will have problems no matter the approach.
A good framework should support both GUI-mapped and descriptive programming notations by operating at object reference level. I.e. you should keep object recognition and object interaction tasks separate.
Note that depending on context Descriptive Programming notation may slowdown performance of your scripts and it always demands extra maintenance effort while in other cases using Object Repositories only may lead to unwanted duplication of objects' descriptions or it may limit recognition of dynamically changing GUI.
I illustrate some points made above in the following article:
A little QTP performance test: Object Repository vs. Descriptive Programming
Straight code examples (for a practical automation I recommend GUI Function Wrapping).
Descriptive programming - addressing objects by physical description properties.
Addressing objects by mapped GUI names
Thank you,
Albert Gareev
http://automation-beyond.com/
我知道我来晚了,您一定已经找到了您想要的东西,但我也想为访问此主题的任何人提供我的意见。
我通常从不使用 OR,除非遇到描述性编程不可行的环境。就在最近,我使用了一个大型机前端 GUI 应用程序,该应用程序完全没有对象命名约定。如果您选择对此类应用程序使用描述性编程,则处理其对象的唯一方法是通过索引或位置序号标识符,考虑到每个窗格中有 100 个对象,这不是最佳操作方案。
因此,您问题的答案实际上取决于环境以及您使用 OR 和 DP 的经验。在我的工作中和在线社区中与我共事的大多数人都喜欢在可行的情况下使用描述性编程。然而,我也看到人们用 OR 创造了奇迹。
我有一些代码示例,但不幸的是,它们涉及描述性编程。例如,以下文章讨论了创建模块化 VBScript 类以将应用程序的功能划分为小的可管理组件:
http://relevantcodes.com/qtp-using-classes-as-test-modules-i/
同样,本文展示了如何使用描述性编程来验证目标对象的多个属性通过单个代码块:
http://relevantcodes。 com/qtp-verify-multiple-object-properties-an-elegant-approach/
另外,您还可以在此处查看演示框架:
http://relevantcodes.com/relevantcodes1one-qtp-automation-framework/
该框架完全基于描述性编程的原则构建,但在下一个版本中,将添加一些功能,使用户也可以使用 OR。
谢谢你,
Anshoo Arora
(感谢 Motti 链接到原始文章)
I know I am late here, and you must already have what you are looking for, but I wanted to provide my inputs as well for anyone visiting this topic.
I generally never use OR, unless I encounter an environment where Descriptive Programming is a no-go. Just recently, I worked with a Mainframe Front-End GUI application that has absolutely no naming convention for objects. If you choose to use Descriptive Programming with such an application, the only way to work with its objects would be through Index or Location Ordinal Identifiers, which is not the best course of action considering 100's of objects in each pane.
So, the answer to your question really depending upon the environment and your experience with OR and DP. Most people I have worked with at my job, and on online communities prefer to work with Descriptive Programming whenever its feasible. However, I have also seen people work wonders with OR.
I have a few code samples, but, unfortunately, they are deal with Descriptive Programming. For instance, the following article talks about creating modular VBScript classes to divide application's functionality into small manageable components:
http://relevantcodes.com/qtp-using-classes-as-test-modules-i/
Similarly, this article shows how Descriptive Programming can be used to verify multiple properties of target objects through a single block of code:
http://relevantcodes.com/qtp-verify-multiple-object-properties-an-elegant-approach/
Also, a demo framework is also available for you to view here:
http://relevantcodes.com/relevantcodes1one-qtp-automation-framework/
The framework is built completely on the principles of Descriptive Programming, but in the next release, some functionality will be added that will enable users to work with ORs as well.
Thank you,
Anshoo Arora
(Thanks for linking to the original articles, Motti)