After wasting an entire day attempting to deploy a huge release to production I'm graveling at the feet of the Salesforce community. So many issues when attempting to package my release (including classes, objects, layouts, pages, triggers and of course my package.xml
). Issues where it would say the vf_custom.page
could not reference the vf_controller.cls
because it did not exist even though it was in the manifest and in the zip. :(
But I digress. Since then I've attempted to try small chunks, but even still I have constant issues. Once being that I cannot even re-deploy test classes that are already in production because since: Summer '15 - API Status Code Changes I now get DUPLICATE_VALUE, duplicate value found
I even re-ran my class currently in production and it failed to pass now because of this error.
Essentially I have a test class for each object that begins like so:
@testSetup public static void virtualSandbox() {
TriggerHandler.bypass('AccountTriggerHandler');
TriggerHandler.bypass('ContactTriggerHandler');
List<Account> accounts = createAccounts(); INSERT accounts;
List<Contact> contacts = ContactTest.createContacts(); INSERT contacts;
TriggerHandler.clearBypass('AccountTriggerHandler');
TriggerHandler.clearBypass('ContactTriggerHandler');
}
This creates the data that the @isTest
methods then use. Because of this change my first @isTest
method (which INSERTS the object this time within the test context), began breaking in the sandbox during development. No big deal I realized the issue was that my test was reinserting what my @testSetup
method already setup. Was never an issue before but it is now. Not a problem, for this test I will delete the accounts before I re-insert them within my Test.startTest()
context like so:
@isTest public static void insertAccounts() {
/* Avoid DUPLICATES_DETECTED error API status change #000214063 */
List<Account> virtualAccounts = [SELECT Id FROM Account];
DELETE virtualAccounts;
List<Account> accounts = createAccounts();
Test.startTest();
INSERT accounts;
Test.stopTest();
System.assert(accounts[0].Id != null,'Accounts were INSERTED');
}
In sandbox this works perfectly. Unfortunately when I attempt to deploy this change to production it appears irrelevant and I continue to get issues. This is killing me and I need sleep so really hoping for some fresh eyes and suggestions for tomorrow. Thank you!
createAccounts()
method look like?createAccounts()
method simple iterates 100 times over to create aList<Account>
. This includes anAccount
with every picklist possibility and all record types, and all required fields. Thanks @crmprogdev makes sense I'll try that first thing this morning.