'功能:提交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
本文转自hcy's workbench博客园博客,原文链接:http://www.cnblogs.com/alterhu/archive/2011/12/31/2309161.html
,如需转载请自行联系原作者。