Newbie request - Including Repository in Code library
Posted: Mon Dec 17, 2012 10:25 am
Hi everyone,
I am developing a code library. I have used Findsingle to find GUI items using the RanorexPath for an item with no problem -
anObject = Host.Local.FindSingle(Of Ranorex.ListItem)(RanorexPath)
anObject.EnsureVisible()
anObject.Click()
However I now want to do a lot more with the repository in my user code without having to copy over all the RanorexPaths for the items I want to interact with.
SO I have seen the bit of code in the recodings which says somethign like: -
''' <summary>
''' Holds an instance of the BaseProject.TestRepository repository.
''' </summary>
Public Shared repo as BaseProject.TestRepository = BaseProject.TestRepository.Instance
But I am not sure how I implement this in my user code library which is outside the project but called from the project. I know this will tie my user code library to this repository but, for our purposes this does not matter.
What I want to do is follow a standard set of steps which creates an on screen object at a particular position. The position should be a paramater (x,y). The actual object is always the same but takes several steps which is why I want to automate it. I know I could add x and y coords as variables to the script but I would prefer to add a single line of usercode to a recording with the x and y params decided by the tester at the time.
I hope I haven't confused you and I hope my request is clear.
Thanks.
orbistest
I am developing a code library. I have used Findsingle to find GUI items using the RanorexPath for an item with no problem -
anObject = Host.Local.FindSingle(Of Ranorex.ListItem)(RanorexPath)
anObject.EnsureVisible()
anObject.Click()
However I now want to do a lot more with the repository in my user code without having to copy over all the RanorexPaths for the items I want to interact with.
SO I have seen the bit of code in the recodings which says somethign like: -
''' <summary>
''' Holds an instance of the BaseProject.TestRepository repository.
''' </summary>
Public Shared repo as BaseProject.TestRepository = BaseProject.TestRepository.Instance
But I am not sure how I implement this in my user code library which is outside the project but called from the project. I know this will tie my user code library to this repository but, for our purposes this does not matter.
What I want to do is follow a standard set of steps which creates an on screen object at a particular position. The position should be a paramater (x,y). The actual object is always the same but takes several steps which is why I want to automate it. I know I could add x and y coords as variables to the script but I would prefer to add a single line of usercode to a recording with the x and y params decided by the tester at the time.
I hope I haven't confused you and I hope my request is clear.
Thanks.
orbistest