Skip to content

Generate a snapshot of your robot on every run so you can see what changed the minute it breaks.

License

Notifications You must be signed in to change notification settings

FormulatedAutomation/Profiler

Repository files navigation

FA Github Header

Formulated Autoamation RPA Resources

FormulatedAutomation-Profiler

FormulatedAutomation PyPI version

image

Introduction

The purpose of this project is to record a snapshot of the runtime environment for an automation workspace. This includes recording installed applications and their versions on the machine. This is especially useful when automations stop working and allows for rapid debugging of machine prior and current states.

⚠️ This project is currently a work in process and should not be used in production environments. ⚠️

Installation

  • Create a virtual environment
  • pip install fa-profiler

Usage

Profiler

*** Settings ***
Library                 FormulatedAutomation.Profiler.System
Suite Teardown          Teardown

*** Keywords ***
Teardown
    Write Profile

If you look in the 'output' directory (which is the current directory, or whatever you speficy at runtime), you'll find an fa_report.yml file. In this file is a profile of the system you ran on, which includes things like

  • Python version and installed packages
  • Environment variables
  • Robot Framework variables (Secrets omitted)
  • Installed programs(on Windows)

It's organized in a way that makes 'diffing' it with a previous report trivial and therefore makes it easy to see what's changed between runs.

Sample Report from Windows CI
Sample Report from Linux CI

Omitting secrets from the profile

There's a good chance you're setting a varaible to something you don't want listed in the logs. In order to prevent secrets from leaking, Profiler will 'redact' any variables with 'secret' in their name. This will later be configurable.

Debugging

The Formulated Automation Profiler also includes some basic debugging tools.

*** Settings ***
Library                 FormulatedAutomation.Profiler.Debug
Library                 FormulatedAutomation.Profiler.System
Suite Teardown          Teardown

*** Keywords ***
Teardown
    Pause On Failure # Launch a Dialog to pause execution whenever a task fails
    Write Profile

*** Keywords ***
Some Task
    Set Breakpoint # Pause execution and drop to Python's 'pdb' debugger
    Do Some Other Task
    Pause for Debug # Pause with a Dialog regardless of failure

Pause on Failure and Pause for Debug only occur if the environment variable 'ROBOT_DEBUG' is set to TRUE. This prevents pausing in production if the keywords are accidentally set.

Command Line Example:

Powershell: $Env:ROBOT_DEBUG = "TRUE"; robot -d output -P src tests
Bash: ROBOT_DEBUG=TRUE && robot -d output -P src tests

Testing

This library expects teh ROBOT_DEBUG environment variable to be set. You can do this however suits your platform:

Powershell: $Env:ROBOT_DEBUG = "TRUE"; robot -d output -P src tests
Bash: ROBOT_DEBUG=TRUE && robot -d output -P src tests

Execute the tests in this project:

robot -d output -P src tests

About

Generate a snapshot of your robot on every run so you can see what changed the minute it breaks.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published