• 軟件測試技術
  • 軟件測試博客
  • 軟件測試視頻
  • 開源軟件測試技術
  • 軟件測試論壇
  • 軟件測試沙龍
  • 軟件測試資料下載
  • 軟件測試雜志
  • 軟件測試人才招聘
    暫時沒有公告

字號: | 推薦給好友 上一篇 | 下一篇

軟件測試工具QTP基礎代碼收集

發布: 2010-5-12 17:48 | 作者: 網絡轉載 | 來源: 領測軟件測試 | 查看: 293次 | 進入軟件測試論壇討論

領測軟件測試網

軟件測試工具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.
  ' Example of usage
  ' Set f = CreateFile("d:\temp\beenhere.txt", True)
  ' f.WriteLine Now
  ' f.Close
  Function CreateFile(sFilename, bOverwrite)
  Set fso = CreateObject("scrīpting.FileSystemObject")
  Set CreateFile = fso.CreateTextFile(sFilename, bOverwrite)
  End Function
 
  ' Opens a specified file and returns a TextStream object that can be used to read from, write to, or append to the file.
  ' iomode: 1 - ForReading, 2 - ForWriting, 8 - ForAppending
  ' Example of usage
  ' Set f = OpenFile("d:\temp\beenhere.txt", 2, True)
  ' f.WriteLine Now
  ' f.Close

Function OpenFile(sFilename, iomode, create)
  Set fso = CreateObject("scrīpting.FileSystemObject")
  Set ōpenFile = fso.OpenTextFile(sFilename, iomode, create)
  End Function
 
  ' Appends a line to a file
  ' Example of usage
  ' AppendToFile "d:\temp\beenhere.txt", Now
  Function AppendToFile(sFilename, sLine)
  Const ForAppending = 8
  If sFilename = "" Then
  sFilename = Environment("SystemTempDir") & "\QTDebug.txt"
  End If
  Set f = OpenFile(sFilename, ForAppending, True)
  f.WriteLine sLine
  f.Close
  End Function
 
  ' Writes a line to a file.
  ' Destroys the current content of the file!
  ' Example of usage
  ' WriteToFile "d:\temp\beenhere.txt", Now
  Function WriteToFile(sFilename, sLine)
  Const ForWriting = 2
  If sFilename = "" Then
  sFilename = Environment("SystemTempDir") & "\QTDebug.txt"
  End If
  Set f = OpenFile(sFilename, ForWriting, True)
  f.WriteLine sLine
  f.Close
  End Function

延伸閱讀

文章來源于領測軟件測試網 http://www.anti-gravitydesign.com/

TAG: qtp QTP 代碼 工具 基礎 軟件測試

31/3123>

關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備2023014753號-2
技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97