设为首页 收藏本站
查看: 2023|回复: 0

[经验分享] A guide to Image-Based Testing with HP UFT’s “Insight”

[复制链接]

尚未签到

发表于 2017-5-28 07:16:47 | 显示全部楼层 |阅读模式
  Motivation
  One of the main competitive advantages of HP Unified Functional Testing (UFT) is its wide support for different technologies. In fact this is probably my most reused PowerPoint slide:
DSC0000.jpg

  But even after supporting all of these technologies (and more), there are always technologies that that are too rare or complex to justify developing UFT support.
  In order to bridge the gap, UFT 11.50 introduced Insight, an image-based form of automation. Insight uses an image in order to identify a test object and is fully integrated into UFT so it can leverage the full range of UFT capabilities such as Record, Learn and Visual Relations Identifiers to name but a few.
  When creating a test we sometimes find that UFT provides good support for the whole application—except for one or two little steps. These one or two little steps may make or break the ability to automate the whole application. In these cases, it is best to mix traditional UFT tests with a couple of Insight steps to get the best of all worlds.
  The power of Insight comes from the fact that it simply requires a graphical interface—the bare minimum that any GUI system supplies. This means that Insight can be used on unsupported technologies such as Flash, or even on a remote desktop connection.
  For the rest of this post I’ll use the Windows Calculator to demonstrate Insight’s capabilities. But don’t allow the simplicity of the examples to distract you from the wide scope of applications that can be automated with Insight.
  The Test
  Usually UFT is able to give test objects descriptive names. This is done by looking at the test objects properties and using some heuristics to decide which properties are most likely to contain a value that will convey meaning to the test maintainer. However, an InsightObject’s description is based on an image, so UFT has no additional insight (oh the irony) into the properties of the test object and is therefore not able to give the object a descriptive name. To avoid a test that contains only objects with names that look like “InsightObject_2”, “InsightObject_3”, etc., UFT inserts the actual image of the test object into the script, which has the added benefit of making the test understandable and maintainable:
DSC0001.jpg

  (Tip: Double clicking the Insight image will open the test object in the object repository)
  Recording
  In order to activate Insight during a record session, change the Recording Mode selection to Insight Recording:
   DSC0002.jpg

  While in the Insight Recording mode, mouse operations will create an Insight step. Keyboard actions, on the other hand, create WinObject.Type steps. The reasoning behind this is that when a mouse event occurs there are coordinates associated with it and UFT can try to understand which object was acted upon, based on the coordinates. Typing presents more of a problem since UFT cannot, in general, determine which object is in focus. Therefore, the text is associated with the top-level window in focus, for example:
  Window("Calculator").WinObject("Text").Type "3"
  The InsightObject does support the Type operation. You can use this method in a test to move the focus to a specific InsightObject before typing.
  Test Maintainance
  Part of the power of Insight is that it captures an image that gives a good representation of the relevant object. Unfortunately, this goal is hindered by the fact that many UI elements nowadays change their appearance when they are interacted with. If Insight captured the image of a UI element when it was hovered over, then UFT could not find it during a run session, because then the element would not be hovered over. For this reason, when recording, Insight captures several images and determines which is the most appropriate to use according to some heuristics. There are cases in which Insight guesses incorrectly, either about which image to choose, or about the bounding rectangle of the UI element. In these cases you can change the image UFT uses for the test object by clicking the Change Test Object Image button:
DSC0003.jpg

  This opens an editor that lets you select a different image from the image history, resize and adjust the location of the rectangle, exclude areas within the image, and modify the test object’s click point (for more details see UFT’s documentation).
DSC0004.jpg

  Exclude Areas
  There are cases in which a UI control contains areas that change without affecting the functionality of the control, and therefore make the image less useful for identification purposes. Such areas may change at random (e.g. advertisements), be dynamically generated (e.g. weather forecasts), or contain text which is localized to different languages. By adding Excluded Areas to the image we can specify that only parts of the captured image should be matched against the application, and the other areas can safely be ignored:
DSC0005.jpg

  Similarity
  Because applications tend to change over time, Insight does not use simple image matching. Instead, Insight looks for controls that are similar to the image in the description. The best match is always used. However, there is a threshold under which images are not considered to match. If you wish to change this threshold value you can add the similarity property to the InsightObject’s description.
  Descriptive Programming
  Insight can be used with descriptive programming as well as via the Object Repository. To use descriptive programming, provide a path to an image file as the ImgSrc property of the test object.
  Window("text:=Calculator").InsightObject("ImgSrc:=C:\img.png")
  The following image file formats are supported: PNG, BMP, GIF and JPEG.
  Conclusion
  I hope this introduction to Insight object identification provides enough information on how, why and when you should start using this feature. Please let us know how useful you find Insight and what problems it solves for you by leaving a comment in the box below.
  You can download HP Unified Functional Testing here.
  http://h30499.www3.hp.com/t5/The-Future-of-Testing-Blog/A-guide-to-Image-Based-Testing-with-HP-UFT-s-Insight/ba-p/6355855

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-381893-1-1.html 上篇帖子: hp mini 5101 安装 ubuntu9.04(1)--fix 影响硬盘寿命 bug 下篇帖子: QTP: Runtime error, X:/Program Files/HP/QuickTest Professional/bin/QTPpro.exe R6
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表