Ranorex Tutorial: A Powerful Desktop, Web, and Mobile Automation Testing Tool

This is Ranorex Hands-on Tutorial #1 (Click here for Tutorial #2).

Ranorex is a powerful test automation tool for everyone, including non-coders, to record automation tests step-by-step for desktop, web and mobile applications.

Maintaining software quality is an important goal for any software system. In today’s world, everything is expected to be fast and efficient enough. The time crunch is seen almost everywhere. In such cases, manual testing does not seem to yield much results, this is where test automation comes into the picture. 

Ranorex Introduction

Test automation is considered to be an important one. And there are hundreds of tools available in the market for automating the test cases. Depending upon the requirement of a software product, the tools need to be chosen accordingly. Ranorex is one such automation tool.

Overview

Ranorex is a very powerful tool to automate tests for web applications, standalone and mobile applications.

It is too simple to use in which even non-coders will be able to use it without hurdles.

It supports all technologies (.Net, Java, Flex, HTML) and can be used for different browsers (IE, Chrome, Firefox) and mobile applications (Android, iOS).

The main component of this tool is its studio which is commonly known as Ranorex Studio. The studio integrates all the tools of Ranorex into one environment. It encompasses Recorder, Object repository, spy, code editor, and debugger.

In this tutorial, we will cover almost all the important topics which include Ranorex License, Studio, Recorder, Spy, Repository, Creating the First Project, Creating a Recording Module and Executing the Test.

Let’s take a look at each of them in detail.

System Settings and Ranorex License

Before starting to work with Ranorex, we need to download and install the tool on our machine. A trial version of the tool is always available on the website.

One needs to register on the official website with a business email id. The link to download and install the trial version will be sent to the registered business email id. When a business email id is not available, then you should contact the sales team and they will help you in downloading the trial version.

Ranorex Download

However, in order to make use of all the features of Ranorex for a long time, one needs to buy the license. A premium license of this tool is usually expensive.

Premium licenses are of two types. They are:

  1. Node-locked
  2. Floating

Both the licenses have all the same features except that a floating license can be shared by more than one user and also be used on virtual environments (Virtual machines and terminal server).

There’s also an addition to the Premium license, called the Runtime license. It allows a user to run tests on more than one machine at a time using the same license.

The system settings for this tool is very simple and the user need not worry much about the necessary components because the Ranorex package itself installs most of the software required for its working. The wizard to install the tool is too simple and easy to understand. One just has to follow the step-wise instruction in the wizard.

This tool supports almost all the windows operating systems, both 32-bit and 64-bit editions.

Ranorex Studio

When the tool is launched, the tool automatically opens the Ranorex Studio.

It looks as below:

Ranorex Studio

The studio offers three views:

  • Project View
  • Module View
  • File View

To put it in simple terms:

Project view displays all the files of a current project.

Module view displays all the modules of the current Project.

File view offers a variety of operations on the opened file.

We will see them in detail while we proceed further.

Ranorex Recorder

Like every other test automation tool, this tool allows the user to record test steps as actions on the application under test and then play it back later. The recorded steps can also be modified and fine-tuned. The recordings can be maintained with the help of Ranorex repository.

Ranorex Recorder

Ranorex Recorder Screen

The Ranorex editor helps in fine-tuning the test steps recorded based on object recognition.

Ranorex Spy

Every test automation tool needs to have an object recognition tool. Object recognition is a process of identifying the Objects (here UI elements) on the screen.

One of the prime parameter that defines how good an automation tool is based its object recognition property and how well it interacts with the object under test. For the same purpose, this tool is having has Ranorex Spy which recognizes the UI elements of the object under test. It gives a hierarchical representation of the element.

Ranorex Sky

The spy is easy to use and displays the XPath of the UI element. Ranorex XPath is similar to expressions. It has many parameters like adapters, attributes, and values. The adapter says what kind of application it is. Attribute and value identify the element type.

<adapter>[@<attribute>=<value>]

/Button[@controlname=’Enter’]

It is also possible to identify a specific type of control or element by changing the XPath. “or” and “and” conjunction can be used in XPath to zero down a particular element.

For Example, to identify all the buttons with text “Enter” can be done by below mentioned path.

/form[@controlName=’FirstForm’]//Button[@text=’Enter’]

The above path will highlight all the buttons with text “Enter” in the form “FirstForm”.

Ranorex Repository

The Ranorex repository creates a logical mapping of the UI elements. All the UI elements of the application under test can be found in this repository. The repository can be created for every project or test cases. It is represented by the .rxrep file.

Ranorex Repository


The repository has two columns which include Item, and Path namely. Item is the UI element of the application and Path is the logical mapping of the UI element. These repository elements can be used within the code file and recordings also. Since each repository automatically generates a.Net source code file, the objects can be used easily for test automation code.

Creating the First Project

As we have seen about the different features that this tool offers, let’s start creating a test project. As soon as we install and launch Ranorex, the home page looks something like the below one.

Creating project in Ranorex

All latest updates about this tool and other information will be available there.

We can start the new solution by either clicking on the “New Test Solution” under Start in the page shown above or by usual Menu options.

New Solution Steps:

  • Click on File => New => Solution
  • You can either choose C# or VB Net depending upon the language that you need.
  • Select Ranorex Test Suite to create a test suite.
  • Enter a name for the test suite.
  • Choose the appropriate path to save the project.
  • Click Create.

Create New Project

A Ranorex project is identified by the extension .rxtst. Once the solution is created, the project view, module view, and file view (test suite) windows are displayed.

Properties

Few observations from the above snapshot:

  • If you observe the project view, there are many files which are already created by default. “Recording1.rxrec” is the recording file in which all the Actions can be added.
  • “FirstProjectRepository.rxrep” is the Ranorex repository files which are a logical representation of all the UI elements of an object under test.
  • The recording file will usually have two files under it, .cs file and.UserCode.cs file.
  • User code file is usually used when the features provided by the recording module is not enough.
  • .cs file cannot be modified by the user, even if did, it will be rewritten by Ranorex in the next run
  • The test suite view already has a Recording module. So we can start recording by simply clicking on that module.

Creating a Recording Module

Given below are the steps involved in creating a recording module:

  • Double click on the Recording module file
  • A new tab opens in the test suite in the test suite view.
  • Click on Record button to start recording.
  • Choose a technology depending upon the software under test.

Choose Technology

  • Select the name of the project by clicking on Add App button in the next window.
  • Now the Record button is enabled. Click on Record to start recording.

Record Desktop Test

  • Perform the test actions by clicking on the UI elements. Once all the actions are performed, click on Stop button in the recorder.
  • Now the recording module will be populated by the actions performed.

Recording Module

  • A range of options is available to modify each step. It can be done just by right clicking on that particular step.

Right Click

Every step is represented in the Action table and each of them is connected to a repository item. The repository item represents a unique UI element. There is also a Comment Column in the recording module. Any comments that we want to add can be written here and that will be reflected in the Report. Comment can be added at every step.

In the recording module, there is a whole range of menu options like Cut, Copy, Delete, Undo, Redo etc. Also if we want to reorder the steps, it can be done easily by selecting that particular step and clicking on Move up or Move down buttons in the Menu.

Add New Action

Executing the Test

To play the test, just click on the Run button in the Test suite view. After clicking on Run, the tool will start building all the assemblies and the test solution. It is followed by sequential execution of all the recorded steps.

Executing Test

Note: Turbo Mode: There is a button called Turbo Mode in the test suite view. When this is enabled, it skips all the delays between test steps unless a delay is been explicitly added. This mode is there to fasten the test execution. But there are cons enabled with this mode.

Sometimes, the skipping of delays can cause problems, for instance when a test has to wait until a window is opened or if a window takes some time to pop up. In those cases, manual entry of delays may be required.

Turbo Mode

Conclusion

In this tutorial, all the basic components of Ranorex have been explained in detail. Once these areas are clear, then automating test cases becomes easy.

To Summarize, given below are few points:

  • Ranorex is a licensed tool for automating test cases for web applications, standalone and mobile applications.
  • This tool supports all technologies like .Net, Java, HTML etc.
  • The main component of this tool is Ranorex Studio which encompasses all the other components.
  • Ranorex spy is an object recognition tool which identifies the hierarchy of UI elements.
  • Recorder allows recording of test steps and replaying the same.
  • The repository will have all the UI elements and their unique logical path.

Ranorex Tutorial #2In the upcoming tutorial, we will see in detail about the usage of UserCode file, test cases & test modules, understand Ranorex Report, ways to edit Xpath and Integration of Ranorex with the Visual Studio.

Feel free to share your thoughts/suggestions about this tutorial and let us know if you have any queries.





6 comments ↓

#1 Surendra

Hi Thank you for considering my request to cover Ranorex tutorials.

This is really helpful.

#2 Ashutosh Jain

Thanks for sharing this. This shows that, in future we will have many options to build automation scripts other than selenium which requires descent knowledge of coding.

#3 Niyati Pandit

Thanks for sharing?.

#4 Claire Mackerras

Imperative! Some of the points are really explained well in detail manner. It have many components like Ranorex studio, Ranorex spy, Ranorex recorder: these all components and its features are firming under the completely integrated test environment.

#5 sunny

Thank you very helpful in my project. I am currently using Ranorex tool in my project.

#6 Mahima

Thanks for your inputs … this is really helpful but can you please share more details on windows Desktop based automation through Ranorex . Thanks again..!!!

Leave a Comment