我已經創建了一堆UFT 12(ex QTP)測試,並且我還創建了一個批處理文件以運行這些測試。通過批處理文件遠程啓動UFT(QTP)測試。
當我在本地運行批處理文件時,測試運行正常。
這裏是我使用的腳本:
Set qtpApp = CreateObject("QuickTest.Application")
Set fsObj = CreateObject("Scripting.FileSystemObject")
Set qtpResObj = CreateObject ("QuickTest.RunResultsOptions")
qtpApp.Launch
qtpApp.Visible= true
sfolderPath = "C:\QA\ManagerForOracleDB"
Set mainFolderObj = fsObj.GetFolder (sfolderPath)
Set testSubFolders = mainFolderObj.SubFolders
sPath = "C:\&formatDate&\"
For each folderobj in testSubFolders
chkfolderobj = folderObj.Path & "\Action0"
if (fsObj.FolderExists(chkfolderobj)) then 'The Folder is a QTP test folder'
qtpApp.Open folderObj.Path, True, False
sResultFolderPath = sPath&folderObj.Name & "\Res" 'Set the results location'
qtpResObj.ResultsLocation = sfolderPath
qtpApp.Test.Run qtpResObj , True
strResult = qtpApp.Test.LastRunResults.Status
WScript.echo strResult
qtpApp.Test.Close
End if
Next
'Send Mail
qtpApp.Quit
'Release the file System objects
Set testSubFolders = Nothing
Set mainFolderObj = Nothing
Set fsObj = Nothing
Set qtpResObj= Nothing
Function formatDate()
str= now()
str=replace(str,"/","")
str=replace(str,":","")
str=replace(str," ","")
formatDate = mid (str,1,len(str-2))
End Function
現在我試圖通過推出其作業遠程執行這些批處理文件。 我面臨兩個問題:
第一:我有一個交互式服務檢測提示與彈出框,我應該點擊查看消息以切換到另一個屏幕,這對我來說是一個問題,因爲我希望UFT在沒有任何用戶交互的情況下自動啓動。
第二個問題:使用此腳本即使在彈出的服務交互中單擊視圖消息時,UFT也不會啓動。
我已經搜索在互聯網上,我發現一個建議先打開UFT所以我加入了這個片斷上面的腳本的頂部:
dim commandLine, WshShell
' Define command line
commandLine = """C:\Program Files (x86)\HP\Unified Functional Testing\bin\UFT.exe"""
Set WshShell = CreateObject("WScript.Shell")
' Start QTP via command line
WshShell.Run commandLine, 8, true
' Wait a while until QTP is loaded (here 10 secs)
WScript.Sleep 10000
set WshShell=nothing
有了這個腳本UFT啓動後,我點擊交互式服務檢測消息但睾丸未啓動。
因此,要恢復我的問題是如何避免交互式服務檢測並直接啓動UFT,以及如何在UFT啓動後開始測試。
感謝 Zied
有關使用自動化接口運行測試的文檔中有示例。交互式服務檢測功能讓我相信UFT是使用不同於執行WSH腳本的用戶安裝的,對嗎? – TheBlastOne
然後我會看看這些文檔。UFT安裝了一個不同的用戶,但我已經用與現在啓動作業的用戶相同的用戶重新安裝了它,但仍面臨着交互式服務問題。 – Ziwdigforbugs