QTP的那些事--执行用例后提交bug到QC中

本文介绍了一个使用VBA编写的函数,该函数能够将BUG信息提交至Quality Center (QC)系统。函数接收包括URL、项目名、用户名、密码及BUG详细信息等参数,通过创建TDConnection对象实现与QC系统的连接,并利用BugFactory对象添加新的BUG记录,最后将记录发布至数据库。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 
'功能:提交bug信息到QC中
'函数参数:url代表连接QC的url(例如http://localhost:8080/qcbin),projectname代表需要执行'QC
'连接的工程名称,username代表QC的用户名,password代表连接QC的用户的密码,buginfo代
'表连接QC后提交的bug信息,数组类型,数组中第一个代表bug的状态,第二个代表bug的主题,
'第三个代表bug的优先级,第四个代表bug需要指派给的人,第五个代表bug的发现人
function connectQC(url,projectname,username,password,buginfo())
'声明QC对象
Dim TDConnection 
Set TDConnection = CreateObject("TDApiOle.TDConnection") 
TDConnection.InitConnection url' URL for the DB 
TDConnection.ConnectProject projectname,username,password   ' Valid login information '登陆QC的工程名,用户和密码
'获得登陆后的操作
If TDConnection.Connected Then 
    MsgBox("Connected to " + chr (13) + "Server " + TDConnection.ServerName _ 
    + chr (13) +"Project " + TDConnection.ProjectName ) 
Else 
    MsgBox("Not Connected") 
End If 
'Get the IBugFactory 得到创建bug的对象
Set BugFactory = TDConnection.BugFactory 
'Add a new empty bug 
Set Bug = BugFactory.AddItem (Nothing) 
'Fill the bug with relevant parameters 
'提交bug的相关信息
buginfo=new array(5)
Bug.Status = buginfo(0)
Bug.Summary = buginfo(1)
Bug.Priority = buginfo(2)    ' depends on the DB 
Bug.AssignedTo = buginfo(3) ' user that must exist in the DB's users list 
Bug.DetectedBy = buginfo(4) ' user that must exist in the DB's users list 
'Post the bug to database (commit) 
Bug.Post 

转载于:https://www.cnblogs.com/alterhu/archive/2011/12/31/2309161.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值