+ 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?

Thanks,
Srinivas 
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.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_fields_describe.htm