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