Add Defect To QC from QTP that use the QCUtil.QCConnection sub

来源:互联网 发布:淘宝上拍卖会是真的吗 编辑:程序博客网 时间:2024/05/29 13:25

QTP执行时,有时我们可能想直接向QC/TD中添加defect, 那么具体怎么做喃?那么我将以两种方式来进行从qtp中提交defect
今天先用第一种方式. 下面是具体代码
' ==================================================================================
'   description :  Add Defect To QC from QTP  that use  the QCUtil.QCConnection  sub ,This code page
'                            from manual ,  It working fine On TD8.2  and qtp10.00  
'   Questtion:  can not support  bug.description? resolve  - -  bug.field("DB_field") = "value",
'   date         : 2009-10-19
'   Author     : namesliu
'   Note: This property is supported only when QuickTest is connected to Quality Center.
' ==================================================================================
Dim QCConnection

Set QCConnection = QCUtil.QCConnection   'Note: This property is supported only when QuickTest is connected to Quality Center.

'Get the IBugFactory
Set BugFactory = QCConnection.BugFactory

'Add a new, empty defect
Set Bug = BugFactory.AddItem (Nothing)

'Enter values for required fields
Bug.Status = "New"
Bug.Summary = "New defect"
Bug.DetectedBy = "namesliu" ' user that must exist in the database's user list
BUG.field ("bg_DETECTION_DATE") = now

' Bug.description   will be erro, bug.field("bg_description") is correct,  so bug.filed is field in DB
bug.field("bg_description") = " the bug detected by QTP!" 

Bug.Post           'Post the bug to the database ( commit )

原创粉丝点击