What's a RepoItemInfo and how do you use it?

Ask general questions here.
afrosteve
Posts: 17
Joined: Mon Feb 22, 2010 10:59 pm

What's a RepoItemInfo and how do you use it?

Post by afrosteve » Wed Mar 17, 2010 6:11 pm

After writing my own code against Ranorex repositories and looking over the sample code, I'm curious what the best way to use a RepoItemInfo class is.

My best guess is that a RepoItemInfo is kind of a barebones class to give you some general ways to interact with a repository item and do some validation, and to ultimately provide a more specific Adapter class for more precise interaction. However, in some of the sample code Adapter's are mostly used with RepoItemInfo's apparently left out. I'm referring mostly to sample code in the WinFormsTest sample.

Is there a better way that I'm missing? What was Ranorex's intent in creating these class relationships? Are there any kind of recommended use guidelines?

Any and all guidance is appreciated!

Thanks,
Steve

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: What's a RepoItemInfo and how do you use it?

Post by Support Team » Fri Mar 19, 2010 11:56 am

A RepoItemInfo (see API documentation) object holds all information of a repository item, e.g. its name and RxPath. It's a description of the repository item in the generated code (i.e. at runtime) and is used to create/search for the element corresponding to the repository item. It's especially useful to check the existance of an element (see the corresponding section in the Ranorex User Guide):
http://www.ranorex.com/support/user-gui ... html#c2517

E.g. if you have a repository item "MyItem" and use the "MyItem" property in code directly, a ElementNotFoundException is thrown if the element corresponding to the repo item cannot be found (internally Ranorex uses the "MyItemInfo" object to search for the element). With the "MyItemInfo" you can use the Exists method to check for the element's existance (and to return the element) without an exception being thrown if the element is not there.
afrosteve wrote: However, in some of the sample code Adapter's are mostly used with RepoItemInfo's apparently left out.
You don't have to use the RepoItemInfo objects, they have been invented in Ranorex V2.1 to ease checking the existance of repository item elements and in order to get information about a repository item at runtime. Most of the samples don't need this functionality.

Regards,
Alex
Ranorex Support Team

afrosteve
Posts: 17
Joined: Mon Feb 22, 2010 10:59 pm

Re: What's a RepoItemInfo and how do you use it?

Post by afrosteve » Fri Mar 19, 2010 3:21 pm

Thank you Alex.

Your explanation and example helped clear up a lot of the confusion I had.

Regards,
Steve