English|Deutsch
Subscribe Ranorex Announcements Feed Ranorex LinkedIn Ranorex twitter Ranorex Facebook

Integrated Ranorex Repository

Each Ranorex repository represents file based mapping information and aims to centralize UI element identification information for easier maintenance. There is no need to change test automation code caused by changing names or other identification attributes within the application under test.

Click here to learn more about how to work with the Repository editor.

Within Ranorex Studio every newly created project automatically contains one main repository file. By default this file is automatically used for every newly created Ranorex recording.

An empty project containing one repository which is automatically related to file 'Recording1.rxrex'

Open the Repository Editor by double-clicking on the *.rxrep file within the project folder. For example one can open the 'Element Browser view (menu item 'View' | 'Element Browser') and track a button within the Calculator application. Add new items to the repository file using the drag&drop feature supported by the element tree.

Default repository file 'EmptyProjectRepository.rxrep'
Adding items from Element Browser to a repository

How to use the Repository for test automation

Use within test automation code

After saving the repository file, Ranorex Studio automatically creates a source code based class representing items or folders from the Ranorex Repository editor. From this automatically generated source code, writing test automation code is quite simple.

Code generated after saving repository file
Manually written test code using the Repository

Use Repository for recording

Normally the Ranorex Recorder will create the required Ranorex Repository independently, but one can also predefine a repository which should be used by a new recording. To assign an already existing repository file to Ranorex Recorder just click the file name button contained in the Recorders toolbar. After the first click the recording uses an embedded repository. Click again to select an already existing repository file.

Changing the recorder related repository
Merge dialog if a repository already exists

Simply click the 'Yes' button to finish and merge already existing items with the new one. Click the 'No' button to overwrite existing repository items.

Start a new Recording and automate some clicks on buttons which are already in the related repository. For new buttons the Ranorex Recorder simply appends those button objects.

Ranorex Studio offers many different ways to create repositories. Be careful when generating repositories automatically with the Ranorex Recorder. You should be certain that frequently used Repository objects are located in one commonly used Repository.

Checking existence of Repository items

Each item and each folder type provides an additional object item declared with '<ObjectName>Info'. It is used to access item related attributes without accessing the UI element directly. The info object is mainly used to check whether an item or a folder path is valid or not.

Info object usage within code

As shown in the picture above the additional info item object avoids to implement an exception handling mechanism just to check for the existence of a UI element.

But in case of validating for existance it might be necessary to have the option to get an exception when an item or a folder does not exist.

C#

                              
// Throws a Ranorex.ValidationException if validation
// fails. Automatically reports success or failed message
// to log file            	            	
Validate.Exists(repo.ErrorDialog.ButtonOKInfo);
				
// Validates the existance of the repository item,
// but does not throw any exception
Validate.Exists(repo.ErrorDialog.ButtonOKInfo,"Check Object '{0}'",false);

VB.NET

' Throws a Ranorex.ValidationException if validation
' fails. Automatically reports success or failed message
' to log file            	            	
Validate.Exists(repo.ErrorDialog.ButtonOKInfo)

' Validates the existance of the repository item,
' but does not throw any exception
Validate.Exists(repo.ErrorDialog.ButtonOKInfo, "Check Object '{0}'", False)

Python

# Throws a Ranorex.ValidationException if validation
# fails. Automatically reports success or failed message
# to log file            	            	
Validate.Exists(repo.ErrorDialog.ButtonOKInfo)
# Validates the existance of the repository item,
# but does not throw any exception
Validate.Exists(repo.ErrorDialog.ButtonOKInfo, "Check Object '{0}'", False)