Did you know… that you can manually generate a recording?

Posted by twalter on Wednesday, November 30th, 2011 at 10:20 am to Best Practices

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.

Manually generate a Ranorex Recording

Manually generate a Ranorex Recording


The Repository

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.

Let’s have a look at text boxes within the application. By tracking the “first name” text box you will get following RanoreXPath:
RanoreXPath

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.

Advanced RanoreXPath Editor

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”.

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

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:

Ranorex Repository

To make your repository hierarchy cleaner, you can add corresponding folders for each type of control (Add New Item -> Simple Folder):

Tidy Repository

The Recording

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:

Choose Repository for Recording

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.

Add Action from Repository to Recording

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.

Ranorex Recording

Ranorex Report

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.
Share

Tags: , , ,

2 comments

  1. Automating Windows 8-style UI Apps (aka Metro) | Ranorex Blog

    [...] If you have problems with recording your Windows 8-style UI, we recommend to manually create your recording using the Ranorex Spy to fill your repository. For further information have a look at our blog post “Did you know… that you can manually generate a recording?”. [...]

  2. Automated Testing and Dynamic IDs | Ranorex Blog

    [...] Since you created a global “path weight rule” for your object identification, the rule will also be applied if you create a repository manually (as described in the blog post “Did you know… that you can manually generate a recording?“). [...]

Leave a Reply