+ Start a Discussion
Mary HandrahanMary Handrahan 

Test class failing due to activated processes in Process Builder

Process Builder seems to be causing issues with Test Classes. They have all failed after we have activated a few new processes in Process Builder. When deactivating the processes and resorting to workflow rules, the test classes do not fail.
PavanKPavanK
You need to modify test classes or process builder according to logic.
Amit Chaudhary 8Amit Chaudhary 8
Please create test data in your test class in such a way that process builder will not fire
MandyKoolMandyKool
Hi Mary,

This might be the issue -
In your process builder logic if you are accessing Lookup fields; then you should check for ISBLANK() else the process builder fails for test classes where lookup fields are not set up (This works fine through UI though)

If it resolves the issue please mark it as solved; so that It will help other.
Todd KadasTodd Kadas
@Amit came across this after fiddling around for a few hours with my test class.  This resolved my issue.  thanks.
Jason Kuzmak 12Jason Kuzmak 12
I also found this post just now after hours of frustration. I thought people were going to tear up Amit's response, but Process Builder was inexplicably reverting my Work Order's ownerId after updating the owners of its child Service Appointment records (during testing only). Telling that segment not to fire during testing was the only thing that worked.