qtp腳本調用函數
❶ qtp測試腳本語言是什麼
QTP是基於VBS腳本語言的,大部分VBS腳本都能在QTP上運行,只是在一些細節上略有不同,比如說VBS上停止用sleep,QTP上用wait。QTP的強大之處在於對程序窗口的操作,有很多針對窗體的屬性、方法,這個是VBS所沒有的。
❷ QTP軟體如何運行vbs腳本
是想問QTP中如何調用VBS中的方法嗎?
如果是的話,你可以將VBS文件作為resource引用進來,然後在QTP的腳本中就可以直接使用了。
或者QTP中有個叫ExecuteFile 的方法,你可以將VBS文件執行下,之後便可以使用了。
❸ QTP的2種腳本調用方法是什麼
QTP的2種腳本調用方法是什麼
我不知道你調用腳本是什麼概念?在QTP中調用外部腳本?還是啟動QTP腳本?
調用外部腳本,你可以採取VBS的程序去調用外部程序,或者你可以寫COM介面,然後再QTP的中調用!
啟動QTP腳本,你可以採取QTP的COM介面通過程序來調用
(3atesing有大量視頻專門介紹QTP的各類實用模式的)
QTP的COM調用可參考:
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Launch QuickTest
qtApp.Visible = True ' Set QuickTest to be visible
' Open a test and get the "Login" action's object repositories collection
qtApp.Open "C:\Tests\Test1", False, False ' Open a test
Set qtRepositories = qtApp.Test.Actions("Login").ObjectRepositories ' Get the object repositories collection object of the "Login" action
' Add MainApp.tsr if it's not already in the collection
If qtRepositories.Find("C:\MainApp.tsr") = -1 Then ' If the repository cannot be found in the collection
qtRepositories.Add "C:\MainApp.tsr", 1 ' Add the repository to the collection
End If
' If InnerWnd.tsr is moved down the list - place it back at position 1
If qtRepositories.Count > 1 And qtRepositories.Item(2) = "C:\InnerWnd.tsr" Then ' If there's more than one object repository and InnerWnd.tsr is in position 2
qtRepositories.MoveToPos 1, 2 ' Switch between the first two object repositories
End If
' If Debug.tsr is in the collection - remove it
lngPosition = qtRepositories.Find("C:\Debug.tsr") ' Try finding the Debug.tsr object repository
If lngPosition -1 Then ' If the object repository was found in the collection
qtRepositories.Remove lngPosition ' Remove it
End If
' Set the new object repository configuration as the default for all new actions
qtRepositories.SetAsDefault ' Set object repositories associated with the "Login" action as the default for all new actions
'Save the test and close QuickTest qtApp.Test.Save ' Save the test qtApp.Quit ' Quit QuickTest Set qtRepositories = Nothing ' Release the action's shared repositories collection Set qtApp = Nothing ' Release the Application object