How to add object in object repository at RunTime in qtp

2,442 views
Skip to first unread message

Santosh Gupta

unread,
Mar 23, 2010, 7:28:54 AM3/23/10
to Mercu...@googlegroups.com
Hi All,
 
Please tell me "How to add object in object repository at RunTime in qtp"
 
 
Thanks,
$

Shirish K

unread,
Mar 23, 2010, 12:39:36 PM3/23/10
to mercu...@googlegroups.com
Get the information from QTP object Module ref

Specify Object Repositories to Associate with an Action

'************************************************************************************************************************
'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
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
 
To unsubscribe from this group, send email to mercuryqtp+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

saurabh gupta

unread,
Mar 24, 2010, 2:27:24 PM3/24/10
to mercu...@googlegroups.com
Hi Santosh,
i believe, you can use OR's API's to do so......
I didn't do that myself but, attached is the way to do so.....
You can try that out and let us know too.......

As Shirish explained, you can associate OR to test and action at run time and this i have used.

here many things depend which version you are using......


On Tue, Mar 23, 2010 at 4:58 PM, Santosh Gupta <est...@gmail.com> wrote:
$

--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
 
To unsubscribe from this group, send email to mercuryqtp+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.



--
Thanks & Regards,
Saurabh Gupta
Synechron Technologies, Pune
Mob. +91-9881375545

-------------------
I have not failed, I've just found 10000 ways that won't work. Thomas A. Edison
OR Util Obj.bmp

Sreedhar Mallipeddi

unread,
Mar 24, 2010, 6:50:19 PM3/24/10
to mercu...@googlegroups.com
Hi,
Set AddObjToOR = Createobject("Mercury.objectrepositoryUtil")
AddObjToOR.AddObject(Object,Parent,name,[LogicalName])
Set AddObjToOR  = nothing

Hope this will help you...


Mallipeddi Sreedhar
215-688-2456

subu

unread,
Mar 25, 2010, 12:58:47 PM3/25/10
to QTP - HP Quick Test Professional - Automated Software Testing
Hi ,

Please check the below link:

http://funwithautomation.blogspot.com/2010/03/quick-test-professional-operations.html

This might help you out. If you need more details just provide your
queries in the comment space.

Thanks
Subrat
http://funwithautomation.blogspot.com/

On Mar 24, 11:27 pm, saurabh gupta <saurabhgupt...@gmail.com> wrote:
> Hi Santosh,
> i believe, you can use OR's API's to do so......
> I didn't do that myself but, attached is the way to do so.....
> You can try that out and let us know too.......
>
> As Shirish explained, you can associate OR to test and action at run time
> and this i have used.
>
> here many things depend which version you are using......
>
> On Tue, Mar 23, 2010 at 4:58 PM, Santosh Gupta <est...@gmail.com> wrote:
> > Hi All,
>
> > Please tell me "How to add object in object repository at RunTime in qtp"
>
> > Thanks,
> > $
>
> > --
> > You received this message because you are subscribed to the Google
> > "QTP - HP Quick Test Professional - Automated Software Testing"
> > group.
> > To post to this group, send email to Mercu...@googlegroups.com
> > To unsubscribe from this group, send email to

> > MercuryQTP+...@googlegroups.com<MercuryQTP%2Bunsu...@googlegroups.com>


> > For more options, visit this group at
> >http://groups.google.com/group/MercuryQTP?hl=en
>
> > To unsubscribe from this group, send email to mercuryqtp+
> > unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> > ME" as the subject.
>
> --
> Thanks & Regards,
> Saurabh Gupta
> Synechron Technologies, Pune
> Mob. +91-9881375545
>
> -------------------
> I have not failed, I've just found 10000 ways that won't work. Thomas A.
> Edison
>

>  OR Util Obj.bmp
> 4052KViewDownload

Reply all
Reply to author
Forward
0 new messages