A repository stores representations of the user interface (UI) elements you interact with in your tests. These representations are called repository items.
Repository items are organized in a tree-like structure. Each item has a RanoreXPath that uniquely identifies the corresponding UI element in your application under test (AUT).
In this article, you’ll learn the core repository concepts and how to add or delete repositories in a Ranorex Studio project.
UI elements
Ranorex Studio tests consist of interactions with UI elements in your AUT, for example, buttons, tabs, drop-down menus, and text fields. Ranorex Studio represents these UI elements as repository items so you can reliably reference them in recordings and code modules.
- Introduction register tab
- Welcome text label
- Text input field
- Submit button
- Reset link
- Exit button
The repository and repository items
Repository items are stored and managed in the repository as a tree.
You can access the repository in these common ways:
Open the repository file (
.rxrep) from the Projects view.Open a recording module (the repository opens automatically).
By default, the repository is shown in the lower section of the Ranorex Studio workspace.
Repository items have a few key characteristics:
Name: By default, the item name is inherited from how the UI element is named in the AUT’s internal structure. You can rename items to make them easier to understand and maintain.
Location in the tree: The folder structure suggests where the UI element is located in the AUT.
Path (RanoreXPath): Each repository item is defined by a path derived from the UI element’s position in the AUT. This path follows the RanoreXPath syntax.
Repository structure
Repositories are organized in a tree-like structure that follows the internal structure of the AUT’s UI:
- UI elements that contain other UI elements are represented as folders in the repository.
- App folders act as top-level elements.
- Rooted folders as children under app folders.
- RxMainFrame is an app folder: It represents the complete program window of the application that contains all other UI elements. In the example, the Exit button in the lower right corner is the only direct child item that doesn’t include other items.
- RxTabIntroduction is a rooted folder: It represents the screen area of the Introduction tab. In the example, it is a direct child of RxMainFrame and contains all UI elements in the Introduction tab.
The repository file
The contents of the repository are stored in a repository file. As with other Ranorex files, you can access it from the Projects view or in the project folder in Windows. Each repository file also has two subfiles.
-
Repository file: The repository file has the file ending
.rxrep, which stands for Ranorex repository. The default file name is a combination of the parent test solution (i.e.Introduction) andRepository. You can rename it as needed. -
Repository code representation: The file with the ending
.csis the code representation of the repository in C#. -
Image hosting file: The file with the ending
.rximghosts all screenshots associated with repository items.
All of these files are also available in the respective project’s folder in Windows.
Add a repository
If your project doesn’t contain a repository, you can add one. You can also add multiple repositories to a project:
In the Studio toolbar, click Add repository.
Enter a name for the repository.
Click Create.
Delete a repository
- In the projects view, select the main repository file (
.rxrep). - Press
DEL.
What happens next depends on whether the repository is in use:
If the repository doesn’t contain any repository items linked to actions, it is deleted immediately.
If at least one repository item is linked to an action, Ranorex Studio shows a confirmation dialog explaining the impact. Confirm to proceed.