About the course
RPA is software, so the development cycle has to include all the established stages, including testing. Done correctly, RPA testing can lower maintenance costs, thus increasing the value brought by automation.
This course positions RPA testing in the overall automation process and covers in depth the relevant features for testing in UiPath Studio. It mainly focuses on unit testing for your RPA workflows and includes best practices from projects implemented by the UiPath development teams.
What you will learn in this course
At the end of this course you should be able to:
- Explain the causes that affect the robot’s stability and how they can be tackled.
- Build the case for RPA testing.
- Describe the levels of RPA testing.
- Create basic and data-driven test cases for RPA workflows.
- Explore the dedicated verification features for RPA Testing.
- Use Test Explorer to group tests together, perform debugging, and analyze activity coverage.
- Use mock testing to simulate real objects in RPA testing scenarios.
- Follow the good case practices identified by RPA developers from real automation projects.
Levels of RPA testing
Since RPA development goes through the regular software development stages, RPA testing is not at all different from software testing. There are four main levels: unit (component) testing, integration testing, system testing, and acceptance testing.
Unit (component) testing: It’s called unit testing because the functionality of an automation project should be broken down into units or components (in the form of workflows) which can be tested individually. Unit testing has the greatest effect on the quality of the project when it’s integrated into the development process, and done by the developers themselves. In unit testing, non-essential or complex objects should be replaced with mock objects.
Integration testing: In this type of testing, the focus is on the interactions between the components or systems. This is typically a subsequent phase after assuring the quality at the component level. This can be done by professional testers or by developers. It can also be done in a continuous integration/continuous deployment framework, in which a test set is executed every time new functionality is added to existing automation.
System testing: The focus here is the entire system. In large end-to-end automation, this would come after the different components have been tested in different configurations and scenarios. System testing requires a dedicated pre-production environment, where testers can get the same experience that the user would have after the automation goes live. The PDD should contain much useful information to create test cases for this level.
Acceptance testing: This also deals with the entire system, but is performed by business users. The goal here is to check if the target audience interacts with the software differently than the developers have intended.
Creating Test Cases
The easiest way to create an RPA test case is to right-click a workflow in the Project panel and select “Create test case”. The test case thus created will have the behaviour-driven development structure.
The verification activities
These activities are meant to be used in the Then block, to verify the outcomes of a test case execution.
Verify Expression
This activity verifies a single expression (e.g. whether two variables are equal). Its outcome can be True or False.
Verify Expression with Operator
This activity compares the outcomes of two expressions, variables or arguments using six predefined operators. Its outcome can also be True or False.
Verify Control Attribute
This is the most versatile activity in the Testing Activities Package. It allows the comparison of a property returned by another Activity with an expression, variable or argument. Its outcome can also be True or False.
Basic vs. data-driven test cases
Basic test cases run with a single set of data, and typically verify the outcomes against static values. To test an RPA workflow in different scenarios, data-driven testing is used. This typically uses an Excel file containing data variations, and the test case runs once for each chosen data set.
A basic test case can be easily converted to a data-driven one by adding the file with the data variations. When doing so, arguments are automatically created with the names of the columns in the data variation file.
The Test Explorer Panel
The Test Explorer panel shows information relevant to test automation. We can use the Test Explorer panels to group tests together, perform debugging, or analyze the activity coverage.
To show only relevant information, you can use the Test Explorer toolbar to filter test results based on the result state. Additionally, you can use multiple options to run the test cases again.
Mock Testing
Automation projects often deal with business applications lacking a separate non-production environment. In such cases, testing the RPA workflows during development can become risky, through the effects in production, or costly, through the special resources needed.
Mock testing, or mocking, offers a way of replacing dependencies by creating objects that simulate the behaviour of real objects. These objects are typically out of scope for the testing effort, at least in the unit testing stages.
RPA Testing Best Practices
Modularity in your automation project
Good testing starts well before the test cases. An automation project should be broken down in atomic workflows, each of them having a single purpose and the smallest possible number of actions. This way, it will be easy to understand and unit-test it.
Modularity in your test cases
A test case should have one purpose and ideally contain one verification. On the other hand, every feature should have a unit test. If there are exceptions, create separate test cases for each of these.
Clean structure
Test cases created from workflows have the Given-When-Then structure. You can use other structures or frameworks, but make sure you keep it clean. If the Given block becomes too cumbersome, it might be a sign that the workflow you are trying to unit-test should be more atomic.
Autonomy
Test cases should be autonomous, meaning that one test case should not depend on another test case’s run.
Mocking
Use mocking whenever there are complex steps irrelevant to the purpose of the test case.
Keep test cases up to date
Update the test cases with each change request.
Reusability
If there are test cases relevant for other automation projects, use the Import Test Case feature in Studio. If you need to rename the test cases, do it only in Studio, not outside.
After unit testing
If your development model is configured for Continuous Integration/Continuous Deployment, include the test cases in the CI/CD pipeline.
Prepare an RPA test set that can be run by the IT team in the pre-production environment, whenever there’s an environment change. On the other hand, run the test set whenever you commit a change to your automation project.
Workflow Analyzer
Use Workflow Analyzer to ensure projects meet high quality and reliability standards. It uses a set of rules to check for various inconsistencies unrelated to project execution.
Facts
What is the cause of the gap between the expected value of automation and the actual one?
Answer: The maintenance costs. The investment needed is always known. The benefits are typically there. The maintenance costs are those that generate the gap.
…
Which of the following issues affect the stability of robots?
Answer:
- Environment issues
- Application issues
- Automation issues
…
Which of the following issues can be fixed in the development stage?
- Automation issues
- Application issues
RPA testing can be done in development to tackle automation issues, as well as application issues. The environment issues are best addressed in the pre-production environment, by the IT Ops teams.
…
Can the mocking feature be used without creating a test case?
Answer: No.
Mock objects can only be created by selecting ‘Mock workflow under test’ in the Create Test Case window. This creates a copy of the workflow with the name workflowName_mock and stores it in Project > Mocks.
…
Which of the following statements about mock testing are true?
Answer:
- In mock workflows, you can only edit the mocked activities.
- In a Given-When-Then test case structure, ‘Surround with mock’ is only available for activities in the When block.
- Changes made in the source workflow file are applied to the mock file whenever the project is saved.
…
Which of the following activities can be used to directly compare the state of a UI element with a value or variable?
Answer: Verify Control Attribute
…
Where can you see the percentage of activities in an RPA workflow covered in an execution of the test case?
Answer: Both in the Activity Coverage widget and Activity Coverage panel
…
Which of the following issues are not typically handled in the RPA development stage?
Answer: Environment issues
…
Which of the following ways of running a data-driven test case are available in Studio?
Answer:
- Only with a single data set
- With a selection of the data sets
- With all the data sets
…