Think. Build. Salesforce Solutions.

Salesforce Consulting Services across Salesforce Clouds & Across App Lifecycles

Blog

Automatic and Codeless Flow Testing

By |2022-08-18T08:56:39+00:00August 18th, 2022|

With the Summer’22 Salesforce release, salesforce introduced View Testing (Beta) to help you test your record-triggered flows. Everyone in the Salesforce ecosystem knows Flow is the future of declarative automation tools. It has started replacing the existing Workflow & Process Builder. After saving the flow triggered by the recording, then the user can click the View Tests (Beta) button to create a new test.

Create, save, and run flow tests in Flow Builder. In the past, you would manually debug your flow and fix any errors as they occurred. Now create and save a flow test from the debug run. Then you can run the test every time you change the flow. Only flow paths that run immediately can be tested. Flow tests do not support flows that run when a record is deleted.

Benefits of Code-less Flow Testing:

  1. Automates the process of determining whether your flows are performing as expected
  2. Saves your time and increases the reliability of your flows.
  3. In flow testing, user configures test parameters and inputs once then same configuration is used to evaluate the flow each time the test is run.
  4. User can edit the test or create more tests for different scenarios.

Steps to Automate the Flow Testing:

1. On the Flow Builder Screen, click on View Tests (Beta) button present on the right corner of the screen.

Automatic and Code-Less Flow Testing
2. For a newly created Flow, On the First Pop-up screen click on Create button to start creating test cases.

Automatic and Codeless Flow Testing
3. In next step, you need to set the test details such as label, API name and description, DML operation (create or update) and set the path of the test (currently there is a Run Immediately option).

Automatic and Codeless Flow Testing
4. It’s time to create the test data, Click on Set Initial Triggering Record on the left side of the screen and set the test data in the form of record and flow will pick the given data for testing.

Automatic and Codeless Flow Testing
5. Finally, we need to Set Assertions. Here you can set multiple conditions without limit and set a custom error message for each condition.

Automatic and Codeless Flow Testing

Set conditions and custom error messages for each assertion to test your flow. At runtime, the test checks all assertions. An assertion passes if all conditions in each assertion are true. Assertions and test execution fail if the assertion’s condition evaluates false. If an assertion fails during test execution, a custom error message is displayed in the test execution details.

6. Once All assertions are in place, save the test window. User will be directed back to flow builder. Click on View Test (Beta) again and if multiple tests are there select the check box on the right side and click on Run button on the right bottom of the screen.

To Run single test or to view, edit or delete test data click on the left side down arrow and select the desired action.

Automatic and Codeless Flow Testing
Beta Limitations and Considerations:

  1. Tests per flow are limited to 200.
  2. View Tests (Beta) only support record-triggered flows and flow paths that run immediately.
  3. Beta Testing does not support packaging and changesets.
  4. The owner of the flow test trigger record will be the last user to edit the test.

Automated flow testing automates the process of determining whether your flows are performing as expected, saving you time, and increasing the reliability of your flows. When debugging a flow, manually configure debug parameters and inputs each time you start debugging. In flow testing, he configures test parameters and inputs once. The same configuration is used to evaluate the flow each time the test is run. By the way, don’t stick to the same tests for each flow. You can edit tests or create more tests for different scenarios. We recommend creating a test for each path your flow can take.

Leave A Comment