如何用QTP腳本刪除一個(gè)文件夾
時(shí)間:
書榮1192由 分享
QTP是Quick Test Professional的簡(jiǎn)稱,是一種自動(dòng)測(cè)試工具。使用QTP的目的是想用它來(lái)執(zhí)行重復(fù)的自動(dòng)化測(cè)試,主要是用于回歸測(cè)試和測(cè)試同一軟件的新版本。下面是學(xué)習(xí)啦小編為你整理的QTP面試題,希望對(duì)你有所幫助!
代碼如下例所示,假設(shè)要?jiǎng)h除的文件夾是在C:\drive.
如何用QTP腳本刪除一個(gè)文件夾:
Dim strDrive, strfoldername,objFSO, objFolder, strPath
strDrive = “c:\” ‘你要?jiǎng)h除的文件夾所在的盤符
strfoldername=”test” ‘你要?jiǎng)h除的文件夾名
strPath= strDrive&strfoldername
‘ 創(chuàng)建FileSystemObject.
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
On Error Resume Next ‘Incase folder is not found
objFSO.DeleteFolder(strPath)
面試題相關(guān)文章: