UiPath Documentation
coding-agents
latest
false
UiPath for Coding Agents user guide
  • Get started
    • Overview
    • Install and set up
    • Choosing your agent
    • Where to run your coding agent
    • Your first build
  • Best practices
  • Capabilities
  • Skills
  • CLI
  • Examples
  • Advanced
  • Help

Recipe: refactor and test a workflow

This recipe takes a workflow you already have, improves its structure and error handling, and adds a test case that proves it still works. It shows that a coding agent is useful well beyond the first build.

Prerequisites

  • A coding agent set up for UiPath work, with an authenticated session (see Install and set up).
  • An existing UiPath project with at least one workflow.

Refactor and test

  1. Open your coding agent in the existing project folder.

  2. Ask it to review first, without changing anything:

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

  3. Review the findings and decide which to apply.

  4. Ask the agent to apply those specific changes.

  5. Ask the agent to add a test case that covers the main path:

    "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 it finds.

  8. Review the diff and the test result before you accept the changes.

Result: a cleaner workflow with better error handling and a passing test that guards it.

Note:

The findings, the file layout, and the run commands vary by agent, project, and prompt. Confirm success from the test result and your own review of the diff, not from the agent's "done" message.

  • Prerequisites
  • Refactor and test

Was this page helpful?

Connect

Need help? Support

Want to learn? UiPath Academy

Have questions? UiPath Forum

Stay updated