Перейти к содержимому

Фотография

Загрузка Object Repository


  • Авторизуйтесь для ответа в теме
Сообщений в теме: 2

#1 mishkail

mishkail

    Новый участник

  • Members
  • Pip
  • 1 сообщений
  • ФИО:Michael

Отправлено 11 июля 2007 - 13:36

Всем привет!
В QTP 8.2 была команда добавления Object Repository, например:
App.Test.Settings.Resources.ObjectRepositoryPath = "...\MyObj.tsr"

Кто знает как ето сделат через код в QTP 9.2?
  • 0

#2 M.J.K

M.J.K

    Новый участник

  • Members
  • Pip
  • 42 сообщений
  • ФИО:Трушков Юрий

Отправлено 12 июля 2007 - 06:46

Всем привет!
В QTP 8.2 была команда добавления Object Repository, например:
App.Test.Settings.Resources.ObjectRepositoryPath = "...\MyObj.tsr"

Кто знает как ето сделат через код в QTP 9.2?


Иногда полезно читать HELP:

Description
This property is no longer supported. Use the methods and properties of the ObjectRepositories collection instead.


  • 0
my Изображение
--------------------
Желай невозможного - достигнешь максимума
(Наполеон)

#3 M.J.K

M.J.K

    Новый участник

  • Members
  • Pip
  • 42 сообщений
  • ФИО:Трушков Юрий

Отправлено 12 июля 2007 - 06:50

'***********************************************************

'Description: 

' 

'This example opens a test, configures an action's object repositories collection 

'and saves the test. 

' 

'Assumptions: 

'There is no unsaved test currently open in QuickTest. 

'For more information, see the example for the Test.SaveAs method. 

'*****************************************************************



Dim qtApp 'As QuickTest.Application ' Declare the Application object variable 

Dim qtRepositories 'As QuickTest.ObjectRepositories ' Declare an action's object repositories collection variable 

Dim lngPosition 



' Open QuickTest 

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

  • 0
my Изображение
--------------------
Желай невозможного - достигнешь максимума
(Наполеон)


Количество пользователей, читающих эту тему: 0

0 пользователей, 0 гостей, 0 анонимных