Skip to main content

How to Test a Flow in Salesforce

Updated · By the Clientell AI team · How we write

To test a Salesforce flow, open it in Flow Builder and click Debug to run it with sample data and read each step. For repeatable checks, use flow tests. A test sets up a record, runs the flow, and checks assertions. Flow tests work for record-triggered flows only.

How to test a Salesforce flow, step by step

Use Debug for a quick look while you build. Use flow tests to check that later changes did not break the flow.

  1. 1

    Debug while you build

    In Flow Builder, click Debug. Pick the input values or a trigger record, run the flow, and read the path it took. Check each element's inputs and outputs.

  2. 2

    Use rollback for safe runs

    In the debug options, run the flow in rollback mode if you do not want the test to save changes to your org.

  3. 3

    Create an automated flow test

    For a record-triggered flow, save it, then open the Tests option in Flow Builder and click New. Name the test and set the record that starts the flow, using field values you choose.

  4. 4

    Add assertions

    Add assertions that state what must be true after the flow runs, such as a field equals a value or a related record was created. A test passes only if every assertion passes.

  5. 5

    Test both sides of each decision

    Write one test for each Decision outcome, including the default path, and one test where nothing should happen.

  6. 6

    Run the tests before you activate

    Run all tests, fix failures, then activate the flow. Run them again after each later change.

  7. 7

    Test non-record-triggered flows by hand

    Flow tests are for record-triggered flows. For screen flows and autolaunched flows, use Debug with several sets of input values, and test in a sandbox.

Sources: Trailhead: Automate Tests in Record-Triggered Flows

The Challenge

Testing Salesforce Flows is often done manually: admins create test records, trigger Flows, and verify outcomes by hand. Complex Flows with multiple decision paths, loops, and error handling require many test scenarios. Bugs in Flows can cause data corruption, failed record updates, and broken business processes.

Or let Clientell AI do it

Clientell AI helps you build and run test scenarios for Salesforce Flows. Describe your Flows and expected behaviors, and Clientell AI generates test plans, identifies potential failure points, and helps debug Flow errors.

How It Works

  1. 1

    Describe the Flow and expected behavior

    Tell Clientell AI what your Flow should do, including expected outcomes for different input conditions and edge cases.

  2. 2

    AI generates test scenarios

    Clientell AI creates test scenarios covering the main path, decision branches, error conditions, and edge cases for your Flow.

  3. 3

    Review test coverage

    Preview the generated test scenarios and add any additional cases needed for complete coverage.

  4. 4

    Run tests and review results

    Execute test scenarios and review results. Clientell AI helps identify and debug any failures.

Frequently Asked Questions

What does Flow testing cover?
Flow testing verifies that each path through the Flow produces the expected outcome: correct record updates, field values, email alerts, and error handling behavior.
Can Clientell AI help debug Flow errors?
Yes. Clientell AI can analyze Flow error messages and debug logs to identify the cause of failures and suggest fixes.
Does it test bulk scenarios?
Clientell AI can help you build test scenarios that verify Flow behavior when triggered by bulk operations (data loads, mass updates), which is critical for avoiding governor limit errors.
How do I debug a flow in Salesforce?
Open the flow in Flow Builder and click Debug. Enter the input values or choose a trigger record, run it, and read the path and element values. Use rollback mode to avoid saving changes.
Which flows can have automated tests?
Record-triggered flows. For other flow types, debug by hand and test in a sandbox.
Should I test a flow in production?
Test in a sandbox first. A flow that changes records can change real data if you run it in production without rollback.

Related Automations

Not sure how your existing automation behaves together? See the Salesforce flow audit.

Getting Started

Ready to automate Flow testing automation?

See how Clientell AI can handle testing automation for Salesforce Flow records. Describe what you need in plain English.

14-day free trial  ·  No credit card required

SOC 2
HIPAA
ISO 27001
Salesforce Partner