Apex Test Failure differences between Deployments and UI due to 'MIXED_DML_OPERATION' errors
|Knowledge Article Number||000205689|
|Description||Customers can sometimes see a difference between the number of Apex Test failures when running all tests via the UI compared to the failure count observed when performing a deployment. A comparison between the differences leads to the conclusion that the differences can be accounted by observing 'MIXED_DML_OPERATION' errors in the UI but not in the deployment, why is this?|
|Resolution||During deployments we do not run mixed DML operation checks, whereas via the UI we do (either 'Run All Tests' or running a test for an individual class). If the differences between the test failures seen in the UI compared to the deployment is solely down to 'MIXED_DML_OPERATION' errors, then this can be deemed expected behavior as we intentionally do not check these in a deployment.
***NOTE*** Same behaviour can also be observed when simply running tests outside of a deployment/validation scenario via the Metadata API, again this is expected behaviour