软件测试工具QTP基础代码收集
1、 将bug添加到QC
Dim TDConnection Set TDConnection = CreateObject("TDApiOle.TDConnection") TDConnection.InitConnection "http://yovav/tdbin" ' URL for the DB TDConnection.ConnectProject "TD76","bella","pino" ' Valid login information 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 Set BugFactory = TDConnection.BugFactory 'Add a new empty bug Set Bug = BugFactory.AddItem (Nothing) 'fill the bug with relevant parameters Bug.Status = "New" Bug.Summary = "Connecting to TD" Bug.Priority = "4-Very High" ' depends on the DB Bug.AssignedTo = "admin" ' user that must exist in the DB's users list Bug.DetectedBy = "admin" ' user that must exist in the DB's users list 'Post the bug to DB ( commit ) Bug.Post |
2、 文件操作函数集:
' Creates a specified file and returns a TextStream object that can be used to read from or write to the file. Function OpenFile(sFilename, iomode, create) |