Repository

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, you’ll 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.

In this chapter

    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 in order to work with them.

    Demo application with UI-elements

    UI elements in the Ranorex Studio Demo Application

    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 projects 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 & repository items

    Repository and repository items

    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.

    Further reading

    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.

    Example for repository structure and GUI sections

    Portions of the UI represented by the repository structure

    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 and subfiles in the projects view

    This is the caption of the image

    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) and Repository. 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.

    Repository files in a project’s folder

    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.
    tipp icon

    Attention

    Be careful when deleting repositories. Ranorex Studio can only locate references for repository items in the currently open solution. If you use the repository in another solution, tests that use its repository items will break.

    Confirmation dialog when deleting a repository that contains linked items