Hey there. I'm trying to test sub flows using apex and hit a wall when trying to confirm multiple variables. My subflow is very simple. It takes recordId as input and tries to find an Account. If an account is found I then use fields on the account to get a custom object record. If no account is found it uses the recordId to get the custom object record and then uses fields from it to get the appropriate account. The sub flow is called from a screen flow that can be launched from either the account or custom object page. Both records returned are assigned to record variables. The sub flow works perfectly in all cases. But I can't get the apex text to pass. Which ever record is queried second is always null in the test. How can I retrieve multiple variables in the same test? I need to be able to show, in one test, that both records are returned. I even tried created an apex defined type with account and the custom object as variables. Again, this works perfectly in the subflow and the parent flow. But the assertNotNull for the second record always fails. Thank you.
Thanks man for the video , i just wanna ask you about the new Testing tool built in flow builder to test flows declaratively , will this feature replaces ( if not already did ) this coding process that you did in this video , thank you sir
I tried to use the built in Flow testing tool a while back. If I remember correctly, it required you to have an existing triggering record set up in your org, and you had to provide it with the Id of that record. I also remember the assertions being really clunky. If and when they make strides in improving the tool, it might be useful. In its current state, I can't recommend it.
Hey there. I'm trying to test sub flows using apex and hit a wall when trying to confirm multiple variables. My subflow is very simple. It takes recordId as input and tries to find an Account. If an account is found I then use fields on the account to get a custom object record. If no account is found it uses the recordId to get the custom object record and then uses fields from it to get the appropriate account. The sub flow is called from a screen flow that can be launched from either the account or custom object page. Both records returned are assigned to record variables. The sub flow works perfectly in all cases. But I can't get the apex text to pass. Which ever record is queried second is always null in the test.
How can I retrieve multiple variables in the same test? I need to be able to show, in one test, that both records are returned.
I even tried created an apex defined type with account and the custom object as variables. Again, this works perfectly in the subflow and the parent flow. But the assertNotNull for the second record always fails.
Thank you.
Thanks man for the video , i just wanna ask you about the new Testing tool built in flow builder to test flows declaratively , will this feature replaces ( if not already did ) this coding process that you did in this video , thank you sir
I tried to use the built in Flow testing tool a while back. If I remember correctly, it required you to have an existing triggering record set up in your org, and you had to provide it with the Id of that record. I also remember the assertions being really clunky. If and when they make strides in improving the tool, it might be useful. In its current state, I can't recommend it.