It’s possible to manually perform all of your recording actions without pressing the record button at any time. This can be accomplished by doing the following. First, you have to generate a Repository holding the UI elements you want to address in your recording. Then, you simply need to associate this repository with your recording and add actions to your recording referring to the UI elements stored in your repository.
The VIP database application, which is included in your Ranorex installation, is taken as a sample application in this blog to illustrate how to generate a recording and the associated repository without the use of the record button.
First of all you have to add a repository to your project (Project->Add->New Item->Repository).
To analyze your application and determine which UI elements are necessary for the recording, open Ranorex Spy.
You can now simply add this control to your repository by right clicking on it and choosing “Add to repository”.
If you’d like to directly add all available text boxes to your repository, you have to add a filter to your RanoreXPath. Therefore, open the Advanced RanoreXPath Editor by clicking on the magic wand which is placed next to the RanoreXPath and uncheck the check box for “controlname” to make the RanoreXPath not only fit to this particular text box with the control name “tbFirstName”.
By verifying your altered RanoreXPath, you will see that 5 elements have been found. To see which controls have been found, click on “Highlight”. As you can see, not only all text boxes, but also all labels fit this RanoreXPath as all of these elements are represented with the text adapter. To filter out only the text boxes – as you do not need the labels within our recording – just check the check box “controltypename” and choose “TextBox”. By verifying this RanoreXPath, you will see that only 2 elements have been found – the 2 available text boxes.
After filtering the needed controls (click OK to close the Advanced RanoreXPath Editor), you can add these controls to your repository by right clicking on the parent folder of the two fitting elements in Spy and choosing “Add Matching Children to Repository”.
To learn more about the RanoreXPath and the Advanced RanoreXPath Editor please have a look at following chapters of our user guide:
After adding the relevant text boxes, let’s add the list items stored in the category list box to the repository. Therefore, track a list item, select the parent list node, right click and choose “Add to Repository (incl. children).
Now that you have the text boxes for first and last name and the list items for the different categories stored in our repository, let’s add the radio buttons for the gender and the add button to your repository.
After doing so, the repository should look something like this:
To make your repository hierarchy cleaner, you can add corresponding folders for each type of control (Add New Item -> Simple Folder):
After adding the necessary controls to the repository, it’s time for creating a recording file (Project->Add->New Item->Recording).
Now you have to connect the newly created recording with the repository created before. This can be done by choosing the repository from the repository list:
After connecting the repository to the recording, you can start with adding actions to your recording table.
The first step which should be done is to start the application under test. Therefore add a “Run Application” action (Add New Action -> Run Application) and choose the executable of the VIP database application.
After that, set the first and last name of the VIP. To do so, you can simply drag & drop the wanted repository item from the repository to your recording. From the context menu that pops up choose “Key Sequence” to use the keyboard to set the value of the text box.
To select a category drag & drop the specific list item from your repository to your recording and choose “Invoke Action” as action type. As action name choose “Select” to select the given list item.
Choosing the gender can be handled the same way as choosing the category.
Pressing the add button can be performed by dragging & dropping the button from the repository to the recording and choosing “Mouse” as action type.
Finally, you can close the application by dragging & dropping the application folder from the repository to the recording and choosing “Close Application” as action type.
Voilà… a recording manually generated without using the record button.
As you can see, you can manually generate a recording from a repository which might be useful
- if you are working in teams and you are sharing one repository to keep the shared repository tidy.
- if your application under test is based on special technologies (e.g. using GDI plug-in to identify elements) and the RanoreXPaths of automatically generated repository items often need to be adjusted in order to make them work reliably.