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
adreameradreamer 

Test code in Managed Released Package

Hi All,

 

I have a managed-released package that is having an issue with a specific client related to test coverage.

 

The package installs fine in the client's production org (EE). The package works with a server outside Salesforce that uses the Metadata API to create custom fields in one of the package custom objects. This is done by creating the XML deploymet file on the fly, and using the deploy method of the Metadata API. This works works in all orgs with no problem. However for this specific client, the deployment fails with an error that says that there is only 65% code coverage and 75% is required.

 

I have a few questions on this:

1. Does the deployment as described above to create custom fields in one of the package custom objects kicks any test code run ?. Given the error message she gets, it seems it does.

 

2. If a test code run is kicked by the remote deployment, does it run all test code on all the code for that org ?.

 

3. In an attempt to look into the problem I did something that, in retrospect, it does not make sense. I tries the "Run All Tests" button in an EE production org where the package is installed. The results was weird because there were a lot of test failures in test methods of the package that said:"System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Start_Time__c, End_Time__c]: [Start_Time__c, End_Time__c]". All the errors were exactly he same, and this does not make sense because the fields Start_Time__c and End_Time__c are not part of the package and are not part of Salesforce as far as I know. I am inclined to think that using the "Run All Tests" button in a prod org where there are managed-release packages it does not make sense. Is that the case ?

 

4. This client has other packages installed (none custom development) and I suspect that one of these packages might be lacking test coverage perhaps ?. What would be the best way to assert this ?. running all test in a sandbox.

 

Thank you very much in advance.

 

Fernando