function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PragadheeshwariPragadheeshwari 

test methods generates an Error while installing package

hi,

 

I have created a managed package and uploaded to beta version without apex failures in test methods but if i install this in developer edition i got an error from test methods,

 

Apex Classes(01pA0000001FAQQ) MyTestMethod

System.DmlException: Update failed. First exception on row 0 with id 701A0000000MpSgIAK; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, MyTrigger1: execution of BeforeUpdate

 

caused by: System.DmlException: Update failed. First exception on row 0 with id a06A0000005ugyWIAQ; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 701A0000000MpSg) is currently in trigger MyTrigger1, therefore it cannot recursively update itself: []

 

(MyNamespace (ManagedPackage)): []

(MyNamespace (ManagedPackage))

External entry point

 

i got an error like this for all my test methods.


i didnt get any error in my developer where i have a created a managed package, but i got while installing this package to another environment.

bob_buzzardbob_buzzard

Does existing data affect your unit tests?  

 

It sounds like you are pulling in similar records to your trigger and updating them - if that is the case, you should exclude any objects present in the trigger.new etc.