发布新日志

  • 啃一啃QTP

    2010-01-12 16:50:07Top 1

    发现自己看帖子看文章,到处留下了脚印~

    但却没时间一一去道谢了!

    感谢各位qtp的前辈!无论是转贴还是随笔,我都感谢!

    更不论很多经验的结晶!

    谢谢,谢谢。

     

    ====================

    随手记下自己遇到一些问题,还有临时解决的办法

    大多很拙劣(有点自知之明),谁有好办法,还望不吝赐教,感谢,感谢

     

  • 匹配全部字符包括换行符的正则表达式

    2010-02-25 10:41:15

    只是暂时解决了这个问题,两行,如果是多行,该怎样写一个万能正则表达式匹配任意,盼指点。

    .*/n.*

    试过不通的如下:

    [.\n]* (这个我不知道为什么不通?)

    (下面的这些我知道了,你知道吗)

    [A-Z0-9 .]+ /n[A-Z0-9 .]+

    [A-Z0-9 .]+

    \w*

    [A-Z0-9.\n\s]*

  • 版本改变,脚本不变

    2010-01-26 16:03:31

    用正则表达式,修改出现版本的控件的属性,

    如dialog的text属性 1.4.0005.0003 改成1.4.0005.000[3-9]

    则以后测试的时候不会认为这个是错了。

    或者,把版本做动态值(待实验)?

  • 遇对象未录制的添加办法

    2010-01-26 15:45:43

    Object Repository->Add Object

    选中未录下的控件,即添加

    添加成功后可以用代码操作。

  • 在报告中报告某一步的正确与否(作为检查点来应用)

    2010-01-26 11:31:31

    来源:qtp帮助

    The following examples use the ReportEvent method to report a failed step.

    Reporter.ReportEvent 1, "Custom Step", "The user-defined step failed."

    or

    Reporter.ReportEvent micFail, "Custom Step", "The user-defined step failed."

    我应用来作为检查点:

    wait(2)
    Set bj= Window("Essentris").WinListView("WinListView")
     str=obj.GetSubItem(0,Columns(0))
    If str<>"qtp001"  Then
       Reporter.ReportEvent micFail,"Find Patient by MRN ","Fail, counldn't find the patient."
    End If

  • 初始化注释项目信息(ZT)

    2010-01-26 11:27:39

     来源软通动力《Mercury QuickTest Professional 8.2教程》
    •-----新建一个文本,输入一些新建Action时常包含的信息,然后保存为ActionTemplate.MST文件,
     并复制到QTP/dat目录下;这样每次新建action都会包含固定的信息了;
    例如:
    '-------------------脚本说明---------------
    '产品版本:      __Build(  )
    '测试员:
    '编写日期:
    '测试功能:
    '脚本类型:
    '被测试对象初始状态:
    '进展程度:
    '基本思路:
    '主要功能函数:
    '历史修改:
    '没解决的问题:
    '--------------------脚本内容-------------

  • (ZT)QTP取出WinListView中对象及子对象的属性

    2010-01-26 10:59:31

    昨天一位朋友问我如何取到搜狗音乐盒播放列表中歌曲的属性,我做了个小试验,将一些函数组合起来用,能够方便的取出WinListView中元素及子元素的属性。以下代码调试通过。

             ReDim Columns(10)
            Set ōbj = Window("搜狗音乐盒").WinListView("SysListView32")
            cColumns = Obj.ColumnCount()
            For iColumn = 0 To cColumns - 1
             Columns(iColumn) = Obj.GetColumnHeader(iColumn)
            Next
            cItems = Obj.GetItemsCount
            For iItems = 0 To cItems - 1
             str ="第 "&iItems+1&" 首歌曲属性列表"& vbCr
             For iColumn =0 To cColumns - 1
               str = str &Columns(iColumn)&" = "& Obj.GetSubItem(iItems ,Columns(iColumn)) & vbCr
             Next
             Msgbox str
            Next
            Set ōbj = nothing


            重要函数介绍:
            ColumnCount函数:Returns the number of columns in a (report-style) list-view control. -----返回list-view有多少栏位
            GetColumnHeader函数:Returns the text header of the specified (report-style) list-view column.-----返回list-view的栏位名
            GetItemsCount函数:Returns the number of items in the combo box list.-----返回list中元素个数
            GetSubItem函数:Returns the text value of a (report-style) list-view sub-item. -------返回list中子元素的栏位值

    来源 http:/ /softtest.chinaitlab.com/QTP/752224.html

Open Toolbar