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.
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.
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.
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.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.
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.
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.
// 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);
' 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)
# 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)
Online User Guide
download as: PDF
