QUESTION:
Some of our custom test classes are failing due to errors from DupeBlocker which is causing us to not be able to deploy our custom code. Is there a way to ignore DupeBlocker in our custom unit tests?
ANSWER:
Yes. There are a few options:
1. Update your unit tests to have SeeAllData=false (which is also the default)
Starting in API version 24.0 SeeAllData=false is the default. Users have to manually specify SeeAllData=true to allow all organization data to be visible to your tests. Customers may see DupeBlocker failures (blocks) in their unit tests when they specify SeeAllData=true for their own unit tests and there's no way for DupeBlocker to prevent or work around that.
2. If you need to keep this setting as true then you can programmatically disable DupeBlocker in your unit tests (re-enable at the end of the unit test) using the following code:
// Disable DupeBlocker
CRMfusionDBR101.DB_Api.disableDupeBlocker();
// unit test here
// Enable DupeBlocker
CRMfusionDBR101.DB_Api.enableDupeBlocker():