# Recipe: refactor and test a workflow

> Review an existing RPA workflow, improve its error handling, and add a test case.

Improve an existing workflow's structure and error handling, and add a test case.

## Prerequisites

- [Install and set up](install-and-set-up.md) complete, and you are signed in.
- An existing UiPath project with at least one workflow.

## Review and test an existing workflow

1. Open your coding agent in the project folder.
2. Ask for a review only:

   "Review `Process.xaml` for missing error handling, risky activity choices, and unclear structure. List the findings with severity. Do not fix anything."

3. Choose the changes to make.
4. Ask the agent to apply only those.
5. Ask for a test case:

   "Add a Given-When-Then test case for the happy path of `Process.xaml`, and register it in the project."

6. Ask the agent to run the Workflow Analyzer and the test.
7. Resolve any problems.
8. Review the diff and the test result before you accept.
