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
Srinivas SSrinivas S 

Managed Package: How to take the precautions to avoid failing the test classes in the target Org?

While making a package we develop test classes to validate Apex Triggers and Apex Classes behaviour and make sure to get 75% code coverage.
After making the managed package if the client installs the package and makes any field mandatory at field-level or introduces a validation rule test classes in the package will fail.

How to handle the above scenario to make sure to avoid failing the test classes even after introducing a validation rules or if they make any field mandatory at field level?

Please share your ideas?

Chris  ByromChris Byrom
I don't see how you could possibly handle every possible validation rule they could come up with. As for required fields you could use the isNillable method of the DescribeFieldResult class to detect currently required fields I suppose.