Our First RPA Bot Challenge! The Guessing Game Bot

The Case Brief

This document outlines the first in-class bot you will create using UIPath software. Specifically, we will begin our RPA journey building a guessing game bot (a common introductory-level bot). You will build this bot in UIPath. There are three steps to the first bot challenge. In Part I we will plan the bot and in Part II we will build the bot, and then break it. In Part III we will fix the broken bot using a try/catch and Part IV offers a more challenging and robust solution to fix the broken bot.

This case serves both as an introduction to the RPA software UIPath and also as a way to think about bot governance. At the conclusion of this challenge, you will have the first tools and familiarity with the software that you will rely upon for creating RPA solutions.

I

Part I: Planning

Part I begins with planning for our automation process and then build the bot using UIPath. To plan the bot, we need to use a concept that programmers use when considering processes that can be automated, the concept of the “happy path.” The happy path is the “normal” path of execution. Nothing goes wrong, nothing abnormal or unexpected happens to the program and the program does not crash/quit before task completion. The process loops as many times as necessary and exits at the right time. We will consider all the steps necessary to implement a guessing game bot and draw the process using the process mapping software LucidChart. To log in, select login with google and then use your UW ID as your username, it will take you to the UW login and you will have free access to LucidChart.

Required:

Create a process diagram in LucidChart for a simple guessing game, consider the following steps in your process diagram:

  1. The computer needs to “think of” a number.
  2. The user has to be prompted to input a guess.
  3. The computer has to notify the user if they are right or wrong.
  4. The user has to continue guessing until they are correct.
  5. The program needs to finish when the user guesses correctly.

II

Part II: Building and Breaking the Bot

After planning the bot, we will begin creating the bot in UIPath. Please watch video material posted on Canvas so that you are familiar with the UIPath workspace and the activities we will work with. This part will help us learn about variables and loops, tools that are fundamental to undertaking and scaling automation successfully.

Required:

First, build a bot in UIPath with the following features:

  • We will build this bot within a “flowchart”.
  • “Assign” a variable that takes a random number between 1-100.
  • An “input dialog” box that collects the guess from the user.
  • Conditional statements using “flow decisions”.
  • Assignment of a hint to the user (too high/too low) again using “assign”.
  • Loop within the flow chart.
  • A congratulatory message that allows for exit from the program using a “Message Box”.

Second, once the bot is complete we will break the bot to introduce debugging (and governance). Here are a few ideas to try:

  • Input your name, or a number spelled out (like “twelve”).
  • Input a really large number (i.e., larger than 2,147,483,647).
  • A negative number.
  • A list of symbols like #@%^&()_
  • Nothing (i.e., just click OK).
UIPath will hit an error and stop running the bot. You will receive an error message “Runtime execution error” that looks like the one below. This error is telling us that what was entered by the user is not a valid value for Int 32, and the program throws a System.Exception error. This is obviously a problem for our bot. More generally, we want to make sure that when our bots execute that they are as free of problems as possible. In this case, we need to build some controls around the interaction of the bot with the user (a common problem with many automation solutions).

III

Part III: Fixing the Bot

What was meant to be a simple guessing game: Guess a number between 1 & 100 and the bot will let you know if you are too high or too low... Eventually the user guesses the right number and the bot congratulates them! The bot is reliable, but people are not…! the bot crashes if the user inputs any non-numeric data. It also crashes if the user gives it too large or too small of a negative number, it even crashes with punctuation so no emojis ☹. What we need to do next is find a control to the guess made by the user so that the bot can automate successfully on its happy path. Even if the user puts in something that could cause the process to crash, we need a step, or steps, in the process that will prevent the program from crashing. What controls could improve this program? One possibility is the UIPath “try/catch” activity. The try/catch activity can enclose other activities, such as the input dialog box activity, the try/catch activity will then catch errors triggered by that other activity. This prevents the bot from crashing when it encounters an error.

Required:

To solve this part, the bot requires updating to include:

  • A “try/catch” activity that covers the input dialog box activity.
  • Set the Exception to “System.Exception” (the error we encountered earlier).
  • Optional: Create an error message to communicate with the user.
Hint: The fastest way to incorporate the try/catch is to right click the Input dialog box and select “Surround with Try Catch (Cnt + T).” This will allow the bot to bypass the error but will not provide the user with any feedback on their mistakes. This can be done within the try/catch but will be a generic piece of feedback. There are times when a user could benefit from customized feedback on their error, this approach is the solution to the more challenging extension in part IV below.

IV

Part IV: Fixing the Bot (Advanced)

This part of the challenge is a more advanced approach at designing controls around the input dialog activity. Specifically, we will build the logic to catch errors and provide feedback to the user of their mistakes. This part of the challenge will introduce additional logic that makes use of the Microsoft .Net / VBA programming languages, which allow UIPath to become a very powerful, semi-code-free, automation software.

Required:

Create a more robust bot which accommodates different user (human) input errors and gives the user feedback. Hints: To solve this problem, the bot needs to be able to handle the input of non-Int 32 data, including non-numeric data, like “twelve” or “#@%^&()_”, empty inputs, non-integer numerical data like decimals, numeric data outside of the Int 32 range, and finally guesses outside of the range 1-100. This is a more challenging exercise and will require more steps. Hints:

  • The variable captured in the input dialog box needs to be changed to string (not Int32 at this step).
  • Logic commands that will be helpful include:
    • isNothing()
    • isNumeric()
    • the length command, eg. Variable.length < 4
    • ToInt32()
  • Optionally you can consider counting the valid and invalid guesses separately (which can be reported to the user as part of the congratulations message.
  • You can provide feedback on the invalid guesses providing as much information as you wish (i.e., how much explanation is needed), an example of a simple feedback form is below.