Loading
Prepare for Email to Become the Default Login ExperienceRead More
Intermittent freezing when using using certain browser versionsRead More
Automate Your Business Processes with Salesforce Flow
Testing Your Flow Before Activation

Testing Your Flow Before Activation

Test your flow before activation to catch errors, verify every path, and prevent data issues. Depending on the flow type, use Test Mode or the Flow Builder debugger to test different scenarios with sample data.

Required Editions

View supported editions.

Test Your Flow in the Debugger

For all flow types except record-triggered and autolaunched flows, use the debug feature in Flow Builder to test your flow before you activate it. The debugger shows you how the flow runs step by step. In the debugger, you see the path that the flow takes, and how resource values change through the flow. If the flow encounters a problem, you can see exactly where the problem is, so you can fix it. To use generative AI to diagnose errors and automatically apply fixes, see Troubleshoot Flow Errors with Agentforce (Beta). Learn more in Test or Troubleshoot Flows with the Flow Builder Debugger and Debug a Template-Triggered Prompt Flow Example.

Test Your Flow in Test Mode

For autolaunched and record-triggered flows, use Test Mode to test flows. In Test Mode, you can configure a test scenario with a triggering record or input values, and save the scenario to reuse it. To learn more about Test Mode, see Testing Your Flow in Test Mode (Beta).

Optionally, you can use automated testing to evaluate expected results automatically. To use automated testing in Test Mode, turn on Scenario Testing Automation and add assertions. When Scenario Testing Automation is on, you can also use isolated test data. Learn more in Automated Flow Testing.

Automatically Test Data Cloud-Triggered Flows

For Data Cloud-triggered flows, use automated flow testing to verify expected results and identify runtime failures before you activate the flow. Learn more in Automated Flow Testing.

Debug and Test Flows as Another User

Turn on an org-wide setting so that admins can debug a flow with the Flow Builder debugger or run a test scenario as a specific user, instead of as themselves. Learn more in Turn On Debugging and Testing Flows as Another User.

Use Sample Data

Avoid using real data during initial testing to prevent accidental record changes or sending a test email to a real customer. Create test records that mimic real-world scenarios without affecting live data.

For example, if your flow is updating contact records, create a few sample contact records before testing your flow, and use those records to test the flow. If your flow runs when a lead record is created, when you test it, make sure you're creating a test lead, not a real one.

If your flow sends an email, make sure that the test email is going to one of your email addresses, not a real person in your org.

Test Different Scenarios

Account for all possible paths the flow could take based on different inputs and conditions. Consider various inputs and potential edge cases for each scenario. For example, if your flow updates a record based on certain conditions, create test cases that meet and don’t meet those conditions. Here are the most important things to test for.

  • Path Coverage: Test all possible paths. For example, if your flow has a Decision element, test each outcome, even the default path.
  • Boundary Conditions: Test with minimum, maximum, and unexpected values.
  • Error Handling: Make sure that fault paths and error messages work as intended.
  • Permission and access: Test as different users to verify that all users have the permissions and data access to successfully run the flow.

Use a Sandbox

We recommend testing in a sandbox so you can test as much as you want without accidentally modifying your data. Learn how to create a sandbox in Create a Sandbox.

IN THIS SECTION:

  • Testing Your Flow in Test Mode (Beta)
    Use Test Mode to configure, save, and run test scenarios for autolaunched and record-triggered flows. To use automated testing in Test Mode, turn on Scenario Testing Automation and add assertions to evaluate expected results automatically.
  • Test or Troubleshoot Flows with the Flow Builder Debugger
    For flows that don't use Test Mode, use the Debug option to test or troubleshoot the flow. Review step-by-step details of how the flow runs and the path it takes.
  • Automated Flow Testing
    Understand assertions, flow versions, and test data before you set up an automated test scenario through Test Mode (beta) or for a Data Cloud-triggered flow.
  • Turn On Debugging and Testing Flows as Another User
    Turn on this org-wide setting once so that admins can debug or test flows as a specific user.
  • Troubleshoot Flow Errors with Agentforce (Beta)
    Use Agentforce to troubleshoot design-time issues in saved flows and run-time errors in active flows, eliminating the need for manual troubleshooting. The Flow Automation agent diagnoses issues, identifies root causes, and explains remediation steps all in natural language. In some situations, the Flow Automation agent can automatically fix the flow for you.
  • Generate Test Scenarios with Agentforce for Flow
    Skip the manual setup and use Agentforce to draft your test scenarios from the command line, without opening Flow Builder. Generate comprehensive test scenarios for a record-triggered, autolaunched, or Data Cloud-triggered flow, including success, fault, and edge-case paths.
  • Debug a Template-Triggered Prompt Flow Example
    Debug a prompt flow that integrates with a prompt template that generates a list of events.
 
Loading
Salesforce Help | Article