I am getting the this error when I “Run All Tests” however the error disappears when I run test for individual classes. With All Tests most of the classes give same error.
*Error Details *
Error Message System.DmlException: Insert failed. First exception on
row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, trgOrphanId:
execution of AfterInsertcaused by: System.QueryException: Record Currently Unavailable: The
record you are attempting to edit, or one of its related records, is
currently being modified by another user. Please try again.Trigger.trgOrphanId: line 23, column 1: [] Stack Trace
Class.testBatchDonorAllocation.myUnitTest: line 39, column 1
Best Answer
In Setup's "Apex Test Execution" page there is an "Options" button that includes a "Disable Apex Parallel Testing" checkbox. Checking that will probably avoid the problem.