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
3 Creeks3 Creeks 

Test methods fail only when installing package

I am creating a managed package and having trouble when installing the managed packaged into a newly-minted org.  Here is what is happening...

As you would expect, the managed package I am creating contains test methods.  A couple of these test methods have the OnInstall=true designation so that the package install will fail if these test methods do not pass.  As part of the data set up for the test methods, they create a couple Users in the User Object.  All of the test methods pass in the dev org that the package is created in.  

When I try to install the package in a new test org, the package install fails due to the Oninstall=true methods not passing.  The message indicates a DML error on the User field digestFrequency.  The message goes on to indicate that the field cannot be updated because the feature has not been enabled.  

The feature it is refering to I am assuming is Chatter, which indeed has not been enabled in the test org.  The test methods that create the users, do not reference digestFrequency or any other Chatter attribute that I can tell.

The odd thing is that Chatter is not enabled in the dev org that the package was created in either, but yet the tests pass there.

When I enable Chatter in the test org, the package installs without any issue.

Any help would be appreciated.  

Thanks

 
Best Answer chosen by 3 Creeks
3 Creeks3 Creeks
I found the answer to this some time ago and just coming back to update the post in case anyone come across it sometime in the future....

This is a known issue. Here is the link:
https://success.salesforce.com/issues_view?id=a1p300000008YXGAA2

Has to do with doing an insert and update on the user object within the same transaction in my test method.

Thanks

All Answers

Andy BoettcherAndy Boettcher
You may want to either create a base package with an extension package to enable Chatter functionality, or branch out your code/unit tests to account for orgs that have Chatter enabled or not.

Check out this post for more info:  http://salesforce.stackexchange.com/questions/34253/managed-package-with-chatter-feeditem-on-env-where-chatter-is-disabled
3 Creeks3 Creeks
I found the answer to this some time ago and just coming back to update the post in case anyone come across it sometime in the future....

This is a known issue. Here is the link:
https://success.salesforce.com/issues_view?id=a1p300000008YXGAA2

Has to do with doing an insert and update on the user object within the same transaction in my test method.

Thanks
This was selected as the best answer