# Automation testing best practices (RPA testing)

> Best practices for designing, maintaining, and running RPA tests, and how to test attended and unattended automations with Orchestrator and Test Manager in Test Cloud.

Follow these best practices to design RPA tests that are easy to maintain and reliable to run.

## Test design

* Keep test cases independent of each other. One test case must not depend on the run of another test case.
* Create small workflows that cover the smallest possible number of actions. Small workflows are easier to understand and unit test.
* Give each test case one specific purpose. Each test workflow should contain only one verification.
* Create a unit test for every feature. If exceptions are allowed, create a separate test for each test case.
* Use the Given-When-Then structure for test cases. If the Given part becomes too extensive to manage, redefine the test case, because it might need more granularity or refactoring.
* Keep test cases modular, because modular tests are easier to maintain. Writing tests can also give feedback on the development, similar to a code review.
* Use mocking to replace complex steps that are irrelevant to the purpose of the test case.

## Reusability and organization

* Use libraries and the Object Repository whenever possible, to increase reusability between test projects, and between test and RPA projects.
* Define a single way of writing test cases by establishing a test management logic.
* Use a folder structure dedicated to testing, and the same test case naming convention across your projects.
* Name activities to reflect the action they perform. Use annotations on activities with non-obvious behavior.
* Use assets for variables that are likely to change and are used many times.
* Perform the following actions on test cases in Studio only, never outside it:
  * Deleting
  * Moving
  * Renaming
* To reference a test case from another project, use **Import Test Cases**.

## Maintenance and execution

* Maintain your test cases and update them after every change request.
* Include the tests in your continuous integration and continuous delivery (CI/CD) pipeline.
* Run your test cases whenever you commit a change to your RPA project, to make sure that you did not introduce a bug.
* Prepare an RPA test set that IT can run in a pre-production environment before rolling out an environment change, such as a Windows update. This helps you catch potential issues before they reach production.

## Stability

* Plan for recovery or retry at different stages of the test, to avoid failed results.
* Validate the state of the application before proceeding with steps that depend on it. For example, add activities that wait for the desired application state before other interactions. Avoid hard-coded delays.
* Use the Simulate Click or Simulate Type options, or send window messages, whenever possible.

## Test attended automations

You can test attended automations through two approaches: attended user acceptance testing (UAT), and unattended regression testing.

### Before you begin

* Make sure that you have a working license for Orchestrator and for Test Manager.

### Attended user acceptance testing

UAT testers, who are manual testers or business subject matter experts, perform this type of testing. The quality assurance (QA) team completes step 1. UAT testers complete steps 2 to 5.

1. Define manual test cases in Test Manager. In each test case, include the following:
   * Prerequisite steps
   * Automation execution
   * Assertions
2. Run a manual test case in Test Manager.
3. Prepare the environment for the attended automation, based on the scenario to test and the prerequisite steps defined in step 1.
4. Run the attended automation through UiPath Assistant.
5. Verify the assertions after the automation finishes.

The results, including screenshots and documents, are available to the UAT tester in Test Manager.

UAT testers require an Attended Automation license. You can provide it in one of the following ways:

* Publish the automation packages to your Orchestrator production environment, which has an allocated Attended Automation license for the UAT tester.
* Allocate a subset of Attended User licenses to your Orchestrator non-production environment.

For details on managing licenses, refer to [About licensing](https://docs.uipath.com/test-cloud/automation-cloud/latest/admin-guide/about-licensing) and [Allocating user licenses](https://docs.uipath.com/test-cloud/automation-cloud/latest/admin-guide/allocating-user-licenses).

### Unattended regression testing

An unattended test robot performs this type of testing. The QA team completes step 1. Automation developers complete steps 2 to 5. Anyone with access to Orchestrator or Test Manager can complete step 6.

1. Define test cases in Test Manager. In each test case, include the following:
   * Prerequisite steps
   * Automation execution
   * Assertions
2. Create test cases on top of your existing automations. Use mock testing for RPA to simulate the actions of attended users.
3. Link the test cases from Studio to Test Manager.
4. Publish the test cases to Orchestrator.
5. Group the test cases into test sets, based on business requirements.
6. Run the test sets manually through Orchestrator and Test Manager, or schedule them in Orchestrator.
7. (Optional) If CI/CD tools are available, use them for fully automated testing and deployment. UiPath provides CI/CD integration through the [Azure DevOps extension](https://docs.uipath.com/cicd-integrations/standalone/2025.10/user-guide/about-azure-devops-extension) and the [Jenkins plugin](https://docs.uipath.com/cicd-integrations/standalone/2025.10/user-guide/about-jenkins-plugin).

Unattended test robots provide execution details and events.

Unattended regression testing requires Testing runtimes. For details, refer to [Testing](https://docs.uipath.com/orchestrator/automation-cloud/latest/user-guide/licensing#testing) in the Orchestrator licensing documentation.
