Testing invocable actions
One of the features of invocable actions I like the most is that developers are forced to create small simple modules of code to run. In our processAccounts
method from the preceding section, for example, while we have not defined a complete logic set, we know that the method here must take a defined set of inputs and produce a defined set of outputs, as it is being called by the Flow and then returning the execution result and context to the Flow. From experience, I tend to see developers build much smaller and contained methods with invocable actions, which makes the code much simpler to test in general.
We test invocable methods and variables in the same way we would test any other Apex code methods. We have covered this in detail multiple times already within the book, but the following again is some simple framework code to highlight the process at a high level:
@isTest private with sharing class AccountFlowUtilities_Test { ...