A repository contains representations of user interface (UI) elements used in a test, called “repository items.”
Repository items are organized in a tree-like structure. Each item has a RanoreXPath that uniquely identifies it and allows Ranorex to link the item with the corresponding UI element of the AUT.
In this chapter, learn how to create, manage, and structure repository items. You will also learn how to use multiple repositories and about special use cases such as embedding repositories.
UI elements
Ranorex Studio tests consist of a series of interactions with elements in an application’s user interface. UI elements include buttons, tabs, drop-down menus, text fields, and so on. Ranorex Studio represents UI elements as repository items to work with them.
-
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 in a tree-like structure. To access the repository, open the repository file from the project view. The repository file also opens automatically when you open a recording module. By default, the repository appears in the lower section of the Ranorex Studio work area.
-
Repository items in tree-like structure
- Each repository item has a name. By default, this name is inherited from what the UI element is called in the internal structure of the AUT.
- You can rename a repository item as desired.
- A repository item’s position in the tree-like structure (i.e. which folder it’s in) suggests where the corresponding UI element is located in the AUT.
- Paths of repository items
- Each repository item is defined by its path.
- The path is derived from the physical position of the UI element in the AUT.
- The path follows a special syntax, the RanoreXPath.
The RanoreXPath is described in Ranorex Studio advanced > ⇢ RanoreXPath.
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, with app folders acting as top-level elements and rooted folders as children.
-
RxMainFrame
- RxMainFrame is an app folder. It represents the complete program window of the application that contains all other UI elements.
- In the example, its only direct child item that doesn’t contain any other items is the Exit button in the lower right corner.
-
RxTabIntroduction
- 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’s 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 the file to your liking.
-
Repository code representation
- The file with the ending
.cs
is the code representation of the repository in C#.
-
Image hosting file
- The file with the ending
.rximg
hosts all screenshots linked to 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 the Add repository button.
-
A dialog opens with the repository template preselected.
-
Name the repository.
-
Click Create.
Delete a repository
-
In the projects view, select the main repository file (
.rxrep
). -
Press
DEL
.
- If the repository doesn’t contain any items that are linked to actions, it is simply deleted.
- If at least one repository item is linked to an action, a dialog informs you about the consequences and you must confirm the deletion.
The link between actions and repository items is explained in Actions and repository items