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

 
'功能:提交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://seniortesting.club
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

原文地址:https://www.cnblogs.com/seniortestingdev/p/2309161.html