51Testing软件测试论坛

标题: object library的路径设置. [打印本页]

作者: jerryshomaro    时间: 2007-4-29 11:29
标题: object library的路径设置.
导入object library能不能用代码实现啊?
作者: 风过无息    时间: 2007-4-29 16:10
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
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
作者: songfun    时间: 2007-4-29 17:45
对,就楼上这么代码就行了




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2