Use Ranorex When Automating Windows Applications


Use Ranorex when working on test automation for Windows applications.


Ranorex has many qualities that recommend it for test automation:
  • uses C# as programming language
  • supports many application types (windows, mobile and web)
  • has an amazing customer support.
The company that built it does not have other products so they put all their focus and resources into Ranorex.

Everything that follows comes from my test automation experience with Ranorex.

I am not working for Ranorex , nor do I have any business relationship with them.

I am just a fan of the product.



Why not using QTP (UFT) for test automation of windows applications?



Until recently, my answer to this question would be that 

  • QTP uses VB Script as programming language
  • Ranorex uses C#




However, QTP (UFT) has a new module called Lean FT which allows the test automation engineer to use not only VB Script but also Java and C#.

So the language is not a problem.

Actually, UFT offers more languages that Ranorex for test automation.


If not the language, then what recommends Ranorex over QTP?


If you ever had a serious problem with any of the HP QA tools (QTP, QUALITY CENTER, LOAD RUNNER), you know that it takes a long time until HP provides a solution.

You have to go through many customer support levels that are most of the time not helpful.

Eventually, after many weeks (or months; I waited for a Load Runner solution for 6 months once), if you are lucky, you get to speak with someone who is knowledgeable enough to help out.


For Ranorex, since they are a 1 product company, you get help in days.

The Ranorex customer support is made of developers.

All you have to do is to add your problem to the forum.

Someone will pick it up and propose a solution (if available).

If you found a bug in the product, you will be provided with an approximate date of the patch.







Ranorex key functionalities

Record And Play

Like many other commercial test automation tools, Ranorex has a record and play module.

You can use it for recording user scenarios while interacting with your application.

The result of recording is displayed in a matrix where you can make changes:
  1. change the action type
  2. add new action
  3. change the order of actions
  4. remove actions
  5. add delays
  6. change objects
You can also see the C# code generated during recording.

This code can be changed if needed.






Another result of the recording is the object repository.

This is the place where you can see details of the objects used in the user scripts:

  • object type (button, label, radiobutton, textbox, image, etc)
  • object attributes
  • object locator (Ranorex uses XPATH for locators)
  • position of the object in the application object tree


Code Modules

In my opinion, in general, you should not use record and play for test automation.

Instead, create the test scripts slowly using code modules.

Code modules are just files with the CS extension where you can create your classes.

The classes are built using C# and can be of 2 types:

  • run-time classes:  they are used for creating the test scripts
  • normal classes: they are used for implementing the interaction with the application

When creating the classes that implement the interaction with the application, you can use the page object model.

This model says that the test scripts should not include test automation API commands so it is a good idea to use it for 

  • keeping your test scripts short and easy to understand
  • creating your own test automation framework



Spy


The spy is a component that allows exploring the application structure.

You can select any component of the application using the spy and get lots of details about it:
  • xpath expression that matches the component
  • component attributes
  • component value
  • position of the component in the application component tree







Ranorex Studio

The development and execution of the test scripts is being done from the Ranorex Studio.

Ranorex Studio is just an IDE similar with Visual Studio and Eclipse.

It has all functionalities needed when creating code and debugging it:

  • debug components
  • refactoring components
  • build components

The Ranorex API can be used from Visual Studio as well.







Test Cases And Test Suites

Test scripts can be added to test cases.

When this is done, it is possible to add to a test case a 

  • setup script (for setting up the environment needed for the test script) 
  • teardown script (for clearing up the environment)

The test cases allow creating data driven test scripts.

This is done by defining variables in the test scripts and binding them to data tables.

The result of executing the test scripts is displayed in HTML reports that can include any data available in the test scripts.






Learning Materials

You will find on the www.ranorex.com site lots of useful and very detailed materials such as
  1. user guide
  2. free webinars
  3. screencasts
  4. many other
If you are interested in the problems that Ranorex users have, you can check the product's forum.







Is Ranorex a good test automation tool for beginners?

It is a very good tool to use when starting learning test automation.

All information that a beginner needs is available on the Ranorex site, either in the user guide, product guide, screencasts or on the forum.

The user guide and screencasts are very detailed and clear and created for beginners.

The forum provides lots of examples and solutions to many problems.

The record and play tool gets the beginner started right away by providing information about
  1. actions
  2. repository
  3. objects attributes
  4. xpath locators
  5. C# code created for each recording session



When Did I Use Ranorex?

The first time I used Ranorex was in 2013.

My employer at that time had a windows application that used Sharepoint workflows for document management.

This application was crashing randomly all over the place.

I suspected a memory leak being the cause of the random crashes.

So I tried using QTP first.

This did not go well as QTP crashed every time I installed it.

It was probably not compatible either with the hardware of the computer I was using or with the enterprise Windows version.

The next tool I tried was Ranorex.

I knew about it from various QA blogs and online testing magazines.

I recorded a few scripts, customized them and then ran them continuously for a few hours.

This was sufficient for confirming that the memory leak is indeed present as the memory used by the application went up 5 times in 1 hour.

The company purchased the Ranorex license after the memory leak investigation and used it in a few projects.


The second time I used Ranorex was this year.

This time, I was looking into automating user scenarios for a WPF application.

The test automation code was used in this case for 2 purposes:


  • check periodically for memory leaks
  • automate the smoke build process




In conclusion, if you cannot use Selenium WebDriver for test automation, try Ranorex.

You will not be disappointed.


Share this