51Testing软件测试论坛

标题: 有个脚本不太明白的地方 [打印本页]

作者: jacksboy    时间: 2008-6-21 19:13
标题: 有个脚本不太明白的地方
有一段脚本:
'Just an example for getting a Java array from some object

set comps = JavaWindow("SwingSet").JavaInternalFrame("Internal Frame Generator").Object.getComponents()
'getComponents()有这个方法么,我在JAVA插件的帮助文件里没看到有这个方法。

'This is the actual workaround - notice the special undocumented command mic_arr_get

set currComp = comps.mic_arr_get(0)

'Now that we have the item we want from the array, let’s print it

msgbox currComp.toString()


下面说的这些方法是从那里来的。。。
According to Tsachi there are two such methods:

mic_arr_get – Receives an index and returns the item at that index in the array. The returned item will always be an object (so we have to use .ToString).
mic_arr_set – Receives an index and an object and sets the appropriate item in the array.

There’re also more sophisticated versions for mic_arr_get: instead of returning an object and then turning it into a sting (or an integer, etc), you can perform both actions in a single action by using these specialized methods:

    mic_arr_get_int : will return the data as an integer
    mic_arr_get_char : will return the data as a single char
    mic_arr_get_double : will return the data as a double (real) number
    mic_arr_get_long : will return the data as a long number
    mic_arr_get_short : will return the data as a short number
    mic_arr_get_byte : will return the data as a byte number
    mic_arr_get_boolean : will return the data as a boolean

Similarly, you can use the specialized methods for inserting specific data-types into an array:

    mic_arr_set_int
    mic_arr_set_char
    mic_arr_set_double
    mic_arr_set_long
    mic_arr_set_short
    mic_arr_set_byte
    mic_arr_set_boolean
作者: 陈能技    时间: 2008-6-21 23:11
问题是?

QTP的帮助文档其实并没有很全面地把所有内容记录,有些函数、对象都没有公布出来,例如DeviceReplay对象:
http://blog.csdn.net/Testing_is_ ... /06/02/2504745.aspx
作者: jacksboy    时间: 2008-6-22 08:45
那么我如何才能知道那些函数那些方法是可以用而没有公布出来的呢,谢谢
作者: 陈能技    时间: 2008-6-22 16:23
我一般是看到别人用了才知道有这些可用的函数。

推荐本人新书《QTP自动化测试实践》,该书的详细目录见:
http://blog.csdn.net/Testing_is_ ... /06/22/2574837.aspx
作者: jacksboy    时间: 2008-6-22 20:17
恩,现在LR已经出了比较多的书了,在QTP书不太多的情况下,这本书看目录还不错。。NET方面讲的比较多,要是能在多讲点JAVA、ORACLE一些典型插件的使用和脚本开发就更好了。




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2