How to Create Test Automation with UiPath Studio

How to Create Test Automation with UiPath Studio

Introduction

Testing robotic process automation (RPA) and applications is becoming increasingly important. Automation is also an essential component in other business areas, such as software development. Shorter release cycles require a continuous, automated testing process. 

Test automation is a field that's grown over the years. A closer look at typical test automation projects reveals that testing is often inefficient. Many automated tests are used on a very temporary basis. Business units and application teams use a wide variety of solutions, and the reuse rate across the entire company is usually low.

However, connecting testing and automation on a single platform offers streamlining in adjacent areas. Instead of maintaining multiple tools, training staff on different skills, and developing similar test modules multiple times, all efforts are merged onto one platform where they are set up efficiently. Here you can find a tutorial, on how easy it is to develop your own test cases within UiPath Studio. 

Approach

To test quickly and efficiently, there's a predefined pattern in UiPath Studio that contains the three basic components which are called Given, When and Then. Just start a new project in Studio and select test case. 

test case creation

In the design area, the pattern mentioned above is automatically made available to you. First, we need a test case. Let's say we want to check our web application UiBank if a loan can be requested by an underaged person. The application shouldn't issue a loan to underage persons after any change or update in the application. 

To verify this functionality we use the given-when-then pattern. Let's start. 

The given It prepares the setup for the test execution and provides that all pre-conditions are met. For example, which variables are set or which application should be started. In our case we use Open Browser activity and launch the UiBank website.

The when

This is where the actual test execution takes place and where all components of the actual test case are located. Examples of these are inputs to the mask like the UiBank (https://uibank.uipath.com) in this tutorial. By the way, this web application of UiPath is generally always very good for testing things. 

In this test case, we fill out the UiBank web frontend with values to apply for a loan. We set the email address, the loan amount, the loan term, the yearly income, and the age. 

The then

Now we want to check if our test case is successful or not. For this we use the verify activity from the activities tree of the UiPath Studio:

For underaged persons we expect an error message "You must be at least 18 years old for a loan". We check this output and return OK or successful if we get this value or NOK if not.

Beside contains there are all common operators from the software development. 

= equal  <> not equal  > larger  >= greater than or equal to  < smaller  <= smaller than or equal to 

Contains: indicates a search for any of the specified words or phrases.  Regex-Match: regular expression pattern against a text string When the test case is executed, the various values are then checked and the scenario runs accordingly. The test can be repeated over and over again and the test data can be easily adjusted via the input file. In this tutorial we use test data to test the age range from 11 to 19 years. 

The test data can be easily imported via the import function. Simply right click on the created test case (xaml) and select "Update Test data": In the following, we can further detail which test data should be used. In our case, we use the entire set. By clicking on import, the test data are loaded into the execution accordingly. 

As a result, it looks like this and you can immediately see in the UiPath Studio what was successful and what not: 

Conclusion

This tutorial shows you how easy it is to create a test automation and run it several times. Don't make the test cases too complex and don't skimp on quality. It's very easy to implement and use in your automation projects when you stick to a given-when-then logic. 

Andreas Obermair headshot
Andreas Obermair

Global Head of Automation, Roboyo

Get articles from automation experts in your inbox

Subscribe
Get articles from automation experts in your inbox

Sign up today and we'll email you the newest articles every week.

Thank you for subscribing!

Thank you for subscribing! Each week, we'll send the best automation blog posts straight to your inbox.