Sweet Potato Tec

Blog

View Test Feature in Flow 

By Muthu / May 15, 2025

“Why Salesforce Admins Should Embrace the View Test Feature in Flow”  Salesforce Flow has revolutionized how admins automate processes no […]

“Why Salesforce Admins Should Embrace the View Test Feature in Flow” 

Salesforce Flow has revolutionized how admins automate processes no code needed. But building the flow is only part of the job. Making sure it behaves correctly, reliably, and safely is crucial. That’s where the “View Test” feature changes the game. It gives admins a native, no-code way to create and manage automated test cases inside Flow Builder.  

What is the View Test? 

The View Test panel in Salesforce Flow displays all test cases for a flow, showing test names, last run times, and results. You can view input data, expected outcomes, and paths for each test, and easily re-run tests after flow changes. 

 Why Is It Important? 

Testing used to require manual record creation and guesswork, which is slow and unreliable.  

View Test solves this: 

  • Catches mistakes before activation – Saves your org from buggy automation. 
  • Saves time – No more manually creating test records every time. 
  • Enables regression testing – Quickly retest after any flow change. 
  • Improves deployment confidence – Ensure flows work properly across sandboxes and production. 

 Key Features 

Here are the main things you can do with View Test: 

  • Create and Save Tests – Input data and expected outcomes. 
  • Run Tests on Demand – Instantly simulate flow runs with a click. 
  • Assertions – Validate if certain field values are set correctly after the flow runs. 
  • Test History – See which tests passed or failed and when. 
  • Detailed Execution Path – See exactly what actions were taken by the flow. 

How to Use It: 

If a Case’s Priority is changed to “High”, the flow should update its Status to “Escalated “

Let’s see a practical example : 

Here’s how to use View Test step-by-step: 

1. Open the desired flow in Flow Builder. 

2. Click the View Tests button in the top-right menu.

3. Click New Test

I. Set a Label and trigger (record created or updated). 

II. Set a Initial trigger Condition  

III. Define test data (updated record values). 

IV. Add assertions to verify expected field changes. 

What Are Assertions in Flow Testing? 

An assertion checks if the flow outcome is correct. If the expected field value matches the result, the test passes, if not, it fails. 

4. Save and Run the test. 

5. Check the result: Pass or Fail  

6. Rerun it anytime, especially after editing the flow.

Create a View Test :

Create a Pass Path Test Case (Positive Test) 

Pass Path Test Case Steps: 

  •  Initial Record: Priority = Medium, Status = New 
  • Update Record: Change Priority to High 
  • Expected Flow Action: Status should update to Escalated 
  • Assertion: Status equals Escalated 
  • Run Test: Flow runs and updates the record 
  • Result: Test passes if Status is Escalated 

Create a Fail Path Test Case (Negative Test) 

Fail Test Case Setup: 

  • Initial Record: Priority = Medium, Status = New 
  • Updated Record: Priority = Medium (no change), Status = New 
  • Expected Result: Flow should not run; Status should remain New 
  • Assertion: Status = New — test fails if flow updates it unexpectedly 

If the flow unexpectedly changes the Status, the test will fail helping ensure your flow only executes under the correct condition and avoids unintended updates 

Best Practices 

  • Use meaningful names: Test_Case_Escalation_On_High_Priority 
  • Add assertions: Don’t just test the path verify the outcome. 
  • Test edge cases: What happens if no change is made? 
  • Retest after changes: Always rerun tests after editing the flow. 
  • Use it before going live: It’s your final quality check. 

Limitations of View Test : 

Performance Overhead: Can slow down with multiple tests. 

Limited Scope: Only works for record-triggered flows. 

Final Thoughts : 

The View Test feature in Salesforce Flow allows you to validate automations by simulating real data changes and asserting outcomes. It eliminates guesswork and ensures reliable, accurate results before going live. This helps create trustworthy automation for both simple and complex processes. 

Scroll to Top