Creating A Test Automation Portfolio Episode 2: RPA Testing

  • OVERVIEW
  • Languge: VB.Net / UiPath proprietary language
  • IDE: UiPath Studio
  • Source Code Management Tool: Github via Github Desktop
  • Type of Tests: UiPath
  • Website Tested: My Local Gym

In my last blog post, I outlined my goals for a test automation portfolio.

In this post, I’d like to talk about how I’ve been doing with the fifth task – writing a Robotic Process Automation (RPA) test framework using the market leading vendor UiPath.

I’d become familiar with UiPath earlier this year, when I was one of the first to take their newly launched foundation exam, UiRPAv1. So I am officially a certified Associate, but I hadn’t done much with the tool since passing the exam, so this seemed a great opportunity to learn by doing.

I’m actually very happy with how this first part of the portfolio has worked out considering my starting point, but let me be clear that in no way do I want to give anyone the impression that this code was a few minutes in the making. This took days of effort, and one helluva lot of Googling. But we all have to start somewhere, and I’m sure the steep learning curve will mean things will be faster next time. Another bonus is I’ve ended up with a nice template that I can use as a jumping off point in future.

The Project

As a result of Coronavirus restrictions, my local gym introduced a pre-booking policy. Members could book either a gym or a pool session up to 7 days in advance. I thought it would be fun to write a robot to automate this booking process.

So, what does it do?

Here is a video of the booking process. Note I do not confirm a booking (as this could not be undone without a phone call to the gym as they have not implemented an online cancellation feature) but the Robot does the following:-

  • Login using secure credentials (triggering an email if this fails)
  • Navigate to a date – in this case default but could be specified by the user in a pop up box
  • Select a time – again using a default value but user can overwrite this
  • Select an activity of either pool or gym – defaulted to gym, however if the user types a value into the pop up this is then read from a SQL Server Express database (that I created from scratch 🤓) and the corresponding activity number is returned
  • Confirm the booking or alternatively remove the booking
  • Logout and close the browser
  • All key processes contain try/catch blocks for exception handling.
A video of the automated process in action

The code was written in UiPath Studio (a free tool) in its proprietary ui language, and some customised fields were written in VB.net. Flows and tests are executed either via Studio manually or via a scheduled robot created in UiPath Orchestrator.

For those new to UiPath or Robotic Process Automation in general, an end to end flow is broken down into key workflows/sequences, which utilise customisable drag-and-drop functions to organise the flow. The process can then be embedded into a state machine framework which allows for reliable execution and error handling.

An example block of code inside a workflow

High Level Overview

Here are the key features of the framework:-

A trigger scheduled the automated running of the process in UiPath Orchestrator

The Code

The code is on my GitHub Repo, and I encourage feedback if you have time. Another new tool that I incorporated was GitHub Desktop, which meant I could commit code directly from UiPath into GitHub, add additional files into file explorer instead of using GitHub’s web UI (which I’ve never really gotten on with) so GitHub Desktop will be my default for managing version control in future.

GitHub Desktop made things easy
UiPath integration with Git

There’s a piece of development work alongside the testing element (in fact, the tests were the easiest bit by far). An Excel spreadsheet included as part of the REFramework standardised template allowed each part of the framework to be tested in isolation. This takes seconds.

Lessons learned

Although it was helpful to me to automate a process for a website I actually use in real life (even though I have no intention of using this automation for anything other than a learning exercise really), automating this website was a mistake. The output has meant that as a portfolio entry this has less value than if I’d chosen, say, a practice site mentioned in Angie Jones’ original blog post such as OpenCart or Restful Booker, because someone wanting to see my code running won’t be able to – the login credentials are stored locally in my Windows Credential Manager and for obvious reasons I won’t be sharing them on GitHub. Next time, I will use something generic so that my code will run for anyone.

An update to the above is that I have now frozen my gym membership, so at present even I cannot run the code itself as my account is frozen so I cannot make bookings and improve the code – I’m kicking myself I didn’t use a generic site as this sort of thing wouldn’t happen!

I’m also guilty of over-engineering this solution in the quest to prove to myself that I can write something “proper”. Bloody imposter syndrome. When I looked through Angie’s GitHub repo she had such nice clean simple structure to her code it was much better to do less and keep it simple, especially when this is something I may need to explain in future job interviews.

Finally, I know full well that if an experienced RPA tester/developer were to review my code they would inevitably find space to improve it (and if anyone is up to the task, I’d genuinely be very grateful). I know, for example, that nested if statements aren’t cute. But I honestly could not think of a better solution. I think this is perhaps where pair programming/code review with an experienced person comes into its own. Two heads are definitely better than one.

That said, I’m still in a celebratory mood having completed the first of my five automation porfolio tasks. Time for a short break, then on to the next one!

2 thoughts on “Creating A Test Automation Portfolio Episode 2: RPA Testing

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: