- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
03-27-2024 03:16 AM - edited 02-14-2025 05:47 AM
Workflow Automation CoE >Flows > Flow and Action Error Handling > Overview: Why and how to test for errors
Goal
In this Workflow Automation Center of Excellence article series, you will learn how to build robust flows, subflows, and flow actions in Workflow Studio and why you want to catch errors early before they impact your business outcomes.
- Overview: Why and how to test for errors?
- Level 1: Flow Actions - Retry and Action Error Evaluation
- Level 2: Flow Logic - Try, Do the following until, Go back to
- Level 3: Flow Error Handling
- Level 4: Good Practices and Summary
Technology
Workflow Studio is our central, low-code Workflow Automation builder that consolidates Flow Designer, Process Automation Designer, Decision Builder, and Action Designer into a single design environment.
To build robust workflow automation, we will use these product features:
- Retry Policies
- Action Error Evaluation
- Try Flow Logic
- Do the following until Flow Logic
- Go back to Flow Logic
- Flow Error Handling
Lastly, we will cover some good practices for error handling and how to set your workflows up for easier debugging.
You can also watch this content in my Academy session on YouTube.
Why invest time in Error Handling?
Many organizations need help to quantify saved time down the road over invested time upfront.
Often, they measure by how much time it takes to build something and don’t factor in how much is spent hunting bugs, doing root cause analysis, and generally trying to figure out what that other developer had in mind while building something three years ago.
Enhanced Efficiency
With that said, when we develop with error handling and testing in mind, we can minimize time spent on debugging and troubleshooting later, and since we will see shorter downtimes, this results in improved operational efficiency.
Improved User Experience
Second, we will most likely make our future self’s lives much easier by providing meaningful and comprehensive error messages. With error handling, flows can fail gracefully, which speeds up service recovery and reduces user frustration.
Optimized System Reliability
Third, error handling allows us to remediate issues with actions or subflows proactively. We can discover and identify new errors faster, and since we already have some error handling in place, it is much easier to implement preventative measures for those scenarios.
How to Test for Errors?
The most straightforward way to test new development is ‘happy path’ testing. More often than not, we test based on the requirements and make sure they work. However, this coin has a second side: testing for the ‘unhappy path.’ We also want to test for scenarios when something doesn’t work and catch unexpected errors before they impact business outcomes.
Break it on purpose
One way to test error handling and the try flow logic is to use an action for which we can know ahead of time that it will throw an error under pre-determined conditions. You can find the instructions for this action on Docs, but the basic idea is to throw an error if the action input equals 1. For all other input values, the action will be completed without issues.
Using a test system
When building integrations, a test system may be used to simulate erroneous outcomes. If you do not have a second ServiceNow instance or a test remote system to test your integrations against, you can use services like Beeceptor and Postman. Both of these have paid plans with more features and capabilities, but for some occasional, limited-scope testing, you can generally get by with the free plans.
Beeceptor allows you to create a mock API endpoint that will return a predefined response. You can even do weighted responses to test random outcomes. One of the examples later in this article has a 10% chance for success and a 90% chance for failure.
While Beeceptor works for your outbound integration tests, Postman provides a way to test inbound integrations if you don’t have test systems for your remote integrations.
Continue Reading
Level 1: Flow Actions - Retry and Action Error Evaluation
Center of Excellence Navigation
- 2,917 Views