UiPath Work Analyzer Guide and Settings, Study notes of Computer science

The document contains learning notes related to UiPath work analyzer

Typology: Study notes

2022/2023

Uploaded on 04/04/2023

ranka-1
ranka-1 🇨🇦

1 document

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
UiPath Work Analyzer Guide and Settings
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download UiPath Work Analyzer Guide and Settings and more Study notes Computer science in PDF only on Docsity!

UiPath Work Analyzer Guide and Settings

Contents

Work Analyzer Guide and Settings ..................................................................................................................... 1

1. Work Analyzer ............................................................................................................................................. 2 1.1. Introduction ......................................................................................................................................... 2 1.2. Before Analyzing Code ........................................................................................................................ 3 1.3. When to Run the Analyzer Tool .......................................................................................................... 3 1.4. Running Analyzer and Error List Panel Details ................................................................................... 4 1.5. Default Work Analyzer Setting and Rules Overwrite Suggestions .................................................... 5 1.5.1. Rules Overview ............................................................................................................................ 5 1.5.2. Rule Overwrite Suggestions ........................................................................................................ 7 1.6. Adding Custom Rule to the Work Analyzer Setting ........................................................................... 8 1.7. Sharing Work Analyzer Setting Among the Developers .................................................................... 8 1.8. Automation Error Types and Reducing Errors by Following the Best Practices Defined in the Work Analyzer Rules ................................................................................................................................................. 8 1.8.1. Compile Error ............................................................................................................................... 9 1.8.2. Runtime Error .............................................................................................................................. 9 1.8.3. Logical Error ............................................................................................................................... 10 1. Work Analyzer

1.1. Introduction

The UiPath Studio has integrated the Analyzer workflow tool for making sure our project follows best practices, maintainability, readability, performance, reusability, reliability, and security requirements. Workflow analysis plays a central part in project development. The ability to perform an analysis on your project ensures high quality and reliability. You can Analyze either a single XAML file or a complete project. The workflow Analyzer performs two types of checks:

I suggest using the “Enforce Analyzer before Run” default setting for our development. I do not like much this setting. Some developer will find useful to fix mistakes as they go. I think it is useful to have enabled these settings:

  • Enforce Analyzer before Publish
  • Enforce Check-In before Publish Below are the cases when the Work Analyzer recommended to run:
  • It is recommended to run the Analyzer tool during the development time and before code is checked into the code repository.
  • Run before publishing. Run the Workflow Analyzer from the PowerShell script in the Azure DevOps pipeline. The PowerShell task should be the first task to be executed from the automation build definition within a DevOps pipeline. The PowerShell script should be used to run UiPath Studio Command Line Executable to analyze an automation and pipe the results to a JSON file. This script can be integrated into an automated error/warning check within a DevOps pipeline. The SharePoint script should be placed in the location where the source code is located.

1.4. Running Analyzer and Error List Panel Details

When you run the Analyze project tool errors, warnings and information will be displayed on the Error list panel. The Analyze file or Analyze project always calls the Validation. Validation errors need to be fixed first and then you need to run again Analyze project to detect other inconsistencies. Below is the Error list screenshot panel with details:

1.5. Default Work Analyzer Setting and Rules Overwrite Suggestions

1.5.1. Rules Overview Workflow Analyzer tool contains a set of rules to cross-check the best practices rules suggested by UiPath of an Automation Project and the default rules can be customized as per your needs. Currently, within the Analyzer tool, there are eight rules’ categories available. Great documentation is provided on the UiPath website. Below is the rule category list with the UiPath documentation URLs: Rule Category Category Code Part URL of the UiPath Documentation Naming Rules NMG Naming Rules (uipath.com) Best Practices DBP Design Best Practices (uipath.com) Project Anatomy Rules ANA Project Anatomy Rules (uipath.com) Maintainability and Readability Rules MRD Maintainability and Readability Rules (uipath.com) Usage Rules USG Usage Rules (uipath.com) Performance and Reusability Rules PRR Performance and Reusability Rules (uipath.com) Reliability Rules REL Reliability Rules (uipath.com) Security Rules SEC Security Rules (uipath.com) Navigate to the Design ribbon tab, then to the Analyze File, and select the Workflow Analyzer Setting menu item to launch the default work analyzer rule list. https://cpubproddsstorage.blob.core.windows.net/files/component_resources/c9a935f9-d58c-49f0- 950 e-d435ba90dd1f.pdf

1.5.2. Rule Overwrite Suggestions

You can enable or disable rules by clicking the checkbox next to each of them. In addition, directly from the Work Analyzer rule interfaces you can directly override some rule settings and change Default Action settings (Error, Warning, Info… ) Rule Id Rule Name Default Rule Setting Overwrite Suggestion ST-NMG- 001 Variables Naming Convention ^(dt_)?([A-Z]|[a-z])+([0-9])$^ ^(dt_)?([A-Z]|[a-z])+$ ST-NMG- 002 Arguments Naming Convention RegEx In: ^in_(dt_)?([A-Z]|[a-z])+([0-9])$ Out: ^out_(dt_)?([A-Z]|[a-z])+([0-9])$ InOut : ^io_(dt_)?([A-Z]|[a-z])+([0- 9])$ Action: Warning RegEx In: ^in_(dt_)?([A-Z]|[a-z])+$ Out: ^out_(dt_)?([A-Z]|[a-z])+$ InOut : ^io_(dt_)?([A-Z]|[a-z])+$ ST-NMG- 009 Prefix Datatable Variables This rule is enabled. Default Recommendation: DataTable Variable should start with a dt_ prefix Action: Warning No particular recommendation for this one. ST-NMG- 011 Prefix Datatable Arguments* The default rule is enabled: Default Recommendation: Datatel Argument should start with a dt_prefix Action: Warning Disable the rule. ST-NMG- 012 Argument Default Values Default Recommendation: Use default values for arguments either for testing individual workflow files, or, in the case of reusable components, for using a default configuration Action: Warning Need more analysis. I am against using default values. We might need to keep it for the development setting but for deployment, we can change the Action set to: Action: Error ST-NMG- 016 Argument Length Exceeded Default Recommendation: Argument name length should not be above 30 characters Action: Warning Need more analysis. We can reduce it to 25. ST-DBP- 002 High Arguments Count Default Recommendation: Minimize the number of arguments for workflow The default setting is 20 Action: Error I suggest reducing the setting to 15 for now. We need to analyze code in our processes and check what is max arguments setting is. ST-DBP- 021 Hardcoded Timeout Timeout properties should not contain hardcoded values. Use defaults, settings, or dynamic values. Action: Warning Need more analysis. I am against using default values. We might need to keep it for the development setting but for deployment, we can change the Action set to: Action: Error

Note: All rues are not included in the list. Currently, I do not have any suggestions but when we gain working experience, we might review them again.

1.6. Adding Custom Rule to the Work Analyzer Setting

Check the work Analyzer rules on the UiPath marketplace. We might not need to invent something if already exist. Search Custom Rules on the UiPath Marketplace: Download RPA Components - RPA Snippets, Workflows, Connectors | UiPath Marketplace Learn to build custom rules: Building Custom Rules (uipath.com)

1.7. Sharing Work Analyzer Setting Among the Developers

Everyone in the ESDC RPA team must have the same settings to makes sure that we are following the same standards and policies. Check the UiPath Configure Rule documentation

1.8. Automation Error Types and Reducing Errors by Following the Best Practices Defined

in the Work Analyzer Rules

According to the UiPath documentation, the analyzer does not identify errors in execution or compilation. From my UiPath training experience, I found that running an analyzer helped me to detect code inconsistency, and fixing it helps me to reduce compile and some runtime errors. Three error types can be encountered during the development process: Compile, Runtime, and Logic errors. Depending on what type of error occurs - a developer should code the automation to handle the exception and react accordingly. There are three main error types:

It is better to fix errors early than later in the automation process.

  • Debug your code and fix run time errors
  • Make sure to have proper System or Application Exception code in place to handle it
  • For Attended robot’s processes provide the user an opportunity to rectify the error Example: Error folder does not exist - Catch the exception - Pause execution - Prompt the user to create the folder - Retry the operation
  • Implement proper exception strategies. Wrap the code in a try-catch block. Allow the application to continue after the try-catch block is complete
  • Follow the best practices to perform graceful shutdown for unrecoverable exceptions
  • Write details of the exception to the log file. Include the specific name of the exception.
  • Inform the user of the error and any steps they can take to help avoid the error in the future.
  • Inform the user of the progress of the process up to the point of the error and what actions they need to take to complete the task.
  • Close any network connections or file system resources.
  • To assist with troubleshooting and problem isolation, a best practice is to wrap all subcomponents of a business task with a try-catch block that logs exceptions. Even if these subcomponents simply re-throw the exception, the data contained in the log file will assist in troubleshooting and help identify opportunities for future enhancements.
1.8.3. Logical Error

Usually, the most difficult error to encounter is the logical error. It is related to a bug in automation that causes it to operate incorrectly, but not to terminate abnormally (or crash). Usually, the business rules need to be added or fix the code to avoid this type of errors. This error cannot be detected with the Analyze project tool and therefore developer needs to review code logic to make sure that automation is working as expected. Do the following:

  • Review PDD, SDD documents and review the automation code to identify logical errors
  • Add business rules code and make sure to have proper Business Exception code in place to handle this type of error Example: If a business exception occurs on queue item number two, the RPA bot should log the exception and prepare the environment to process queue item number three. The bot should recover from exceptions and continue processing all the transactions. If an unexpected error occurs, the robot should notify a human operator via email and include a screenshot of the error message, when the error occurred, important argument values, and the source of the error.

https://docs.uipath.com/studio/docs/building-custom-rules?u=nerlichman#section-add-rules-to-studio

  • project description missing
  • at least one log message in the workflow
  • if UiPath project is using RE-Framework or not. References: UiPath Workflow Analyzer & Activity Creator: Step-by-step Tutorial - YouTube https://www.youtube.com/watch?v=tF0EClvJHqA GitHub - PowerShell/PSScriptAnalyzer: Download ScriptAnalyzer from PowerShellGallery https://docs.uipath.com/studio/docs/naming-rules https://docs.uipath.com/studio/docs/design-best-practices https://docs.uipath.com/studio/docs/project-anatomy-rules https://docs.uipath.com/studio/docs/maintainability-readability-rules https://docs.uipath.com/studio/docs/usage-rules https://github.com/mghextreme/uipath-validator/releases/tag/v0. https://docs.uipath.com/studio/docs/performance-and-reusability-rules https://docs.uipath.com/studio/docs/reliability-rules https://docs.uipath.com/studio/docs/security-rules https://docs.uipath.com/studio/v2019/docs/about-workflow-analyzer