51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 5534|回复: 13
打印 上一主题 下一主题

[求助] 着急.Tools->Object Identification,识别方式

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2007-9-24 10:25:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
1测试积点
有谁知道QTP的Tools->Object Identification中的设置如何能保存共享?这个识别方式似乎只能对本地用,到其他机器上无效.
比如:我把standart windows下的winobject 的Mandatory Properties的识别方式改变了,我希望QTP以后在任何机器上都按我的设置去识别winobject,我该怎么处理????是否用Smart Identification.

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2007-9-24 10:27:17 | 只看该作者

在线等待ing

.....
回复

使用道具 举报

该用户从未签到

3#
发表于 2007-9-24 10:44:26 | 只看该作者
把QTP的配置写到VBS里面,以后启动QTP通过这个vbs来
回复

使用道具 举报

该用户从未签到

4#
发表于 2007-9-24 11:13:52 | 只看该作者
原帖由 Jimmyshao 于 2007-9-24 10:44 发表
把QTP的配置写到VBS里面,以后启动QTP通过这个vbs来



我的支柱大哥,对于我们这些想在论坛中学点东西的人
您说的一番话,实在高深末测呀
能给小弟们,给点事例等等,好发扬广大您的精神。。。

期待。。。
回复

使用道具 举报

该用户从未签到

5#
发表于 2007-9-24 12:19:18 | 只看该作者
参考一下以下代码吧~这个就是3楼所提到的用VBS文件配置QTP设置,将以下代码保存在vbs文件中,然后运行此文件启动qtp

'************************************************************************************************************************
'Description:
'This example opens QuickTest and configures the Object Identification settings for the WinList object class.
'************************************************************************************************************************
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtIdent 'As QuickTest.ObjectIdentification ' Declare the ObjectIdentification object variable
Dim qtWinListIdent 'As QuickTest.TestObjectClassIdentification ' Declare the variable for the WinList object class identification
Dim intPosition ' Declare a variable for storing positions

' Open QuickTest and set variables
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible
Set qtIdent = qtApp.Options.ObjectIdentification ' Return the ObjectIdentification object
Set qtWinListIdent = qtIdent.Item("WinList") ' Return the collection of object identification properties for the WinList object class

qtIdent.ResetAll ' Reset the Object Identification description for the WinList object to the default property set
qtWinListIdent.OrdinalIdentifier = "Index" ' Set Index as the ordinal identifier

' Configure the Mandatory Properties
intPosition = qtWinListIdent.MandatoryProperties.Find("nativeclass") ' Find the location of the "nativeclass" mandatory property
qtWinListIdent.MandatoryProperties.Remove intPosition ' Remove the "nativeclass" mandatory property from the list

If qtWinListIdent.AvailableProperties.Find("items count") <> -1 Then ' If "items count" is an available property for WinList
    qtWinListIdent.MandatoryProperties.Add "items count" ' Add it as a mandatory property
End If

' Configure the Assistive Properties
qtWinListIdent.AssistiveProperties.RemoveAll ' Remove all assistive properties
qtWinListIdent.AssistiveProperties.Add "all items" ' Add the "all items" property as an assistive property
qtWinListIdent.AssistiveProperties.Add "width", 1 ' Add "width" as the first assistive property
qtWinListIdent.AssistiveProperties.Add "height", -1 ' Add "height" as the last assistive property
qtWinListIdent.AssistiveProperties.MoveToPos 2, 1 ' Move the second assistive property (currently "all items") to the first position in the list

' Configure the Smart Identification
qtWinListIdent.EnableSmartIdentification = True ' Enable the smart identification mechanism for the WinList object

If qtWinListIdent.BaseFilterProperties.Count = 0 Then ' If there are no Base Filter properties
    qtWinListIdent.BaseFilterProperties.Add "x" ' Add the "x" property as a base filter property
    qtWinListIdent.BaseFilterProperties.Add "y" ' Add the "y" property as a base filter property
End If

qtWinListIdent.OptionalFilterProperties.Add "abs_x", 1 ' Add "abs_x" as the first optional filter property
qtWinListIdent.OptionalFilterProperties.Add "abs_y", 2 ' Add "abs_y" as the second optional filter property
Set qtWinListIdent = Nothing ' Release the WinList identification object
Set qtIdent = Nothing ' Release the ObjectIdentification object
Set qtApp = Nothing ' Release the Application object

[ 本帖最后由 hsjzfling 于 2007-9-24 12:24 编辑 ]
回复

使用道具 举报

该用户从未签到

6#
发表于 2007-9-24 12:22:19 | 只看该作者
楼主只需要WinList替换为你所需要的WinObject,将.Add后的属性替换为你所需要的属性即可,不需要的功能可以注释掉
回复

使用道具 举报

该用户从未签到

7#
发表于 2007-9-24 14:53:18 | 只看该作者
厉害
回复

使用道具 举报

该用户从未签到

8#
发表于 2007-9-24 15:29:59 | 只看该作者
qtp里面自带的功能就有了,为什么还要自己写点什么代码呢?object identification 里面的generate script按钮就是专门干这个用的,导出的script在执行后,重新启动qtp就把设置替换回来了!!!!

楼主下次悬赏不要给这么点。。。要出手就要大方点,不然我这种高手是不会出场的。
回复

使用道具 举报

该用户从未签到

9#
 楼主| 发表于 2007-9-24 16:02:16 | 只看该作者

回复 #8 jackymail 的帖子

呵呵,本着治病救人的想法,想和大家多交流交流.奥运精神曰:参与第一,比赛第二.所以在这个论坛中是交流第一,分数第二.所以没考虑分数的事情..
回复

使用道具 举报

该用户从未签到

10#
 楼主| 发表于 2007-9-24 16:02:44 | 只看该作者

本贴已结

谢谢楼上的各位朋友.
回复

使用道具 举报

该用户从未签到

11#
发表于 2007-9-24 16:47:57 | 只看该作者
QTP自带生成配置脚本
回复

使用道具 举报

  • TA的每日心情
    开心
    2016-2-27 08:48
  • 签到天数: 2 天

    连续签到: 1 天

    [LV.1]测试小兵

    12#
    发表于 2007-9-24 21:41:25 | 只看该作者
    补充一点:修改了QTP的Tools->Object Identification中的设置后,它只对修改后录制的脚本发挥作用。
    回复

    使用道具 举报

    该用户从未签到

    13#
    发表于 2007-9-25 11:44:07 | 只看该作者
    强人很多
    回复

    使用道具 举报

    该用户从未签到

    14#
    发表于 2007-12-24 23:11:56 | 只看该作者

    QTP识别方式

    我觉得你在保存一个Test后可以在
    C:\Program Files\Mercury Interactive\QuickTest Professional\Tests这个目录下,把你的Test复制到其他机器下,然后再用QTP打开你的这个Test,应该就可以了
    (前提是你的被测系统在你的机器和其他机器下都在
    C:\Program Files\Mercury Interactive\QuickTest Professional\samples这个目录下)
    回复

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-5-17 15:38 , Processed in 0.079481 second(s), 25 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

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