I'm writing my first batch class -- it looks for existing Contact records where AccountId is the Id of a dummy account and where the value in Company_Plain_Text_Field__c is a string-match to any existing Account.Name field in the database.
I've been writing a test class and have the logic good, and now I want to stress-test it.
The problem is that our org is so overloaded with nasty triggers on Contact that I can't even run this code to lay down test data without a CPU Limits error (I know it's this, because I commented out the part of the test class that was actually invoking the batch class):
for (Integer i = 0; i < 3000; i++) {
cs.add(
new Contact(
AccountId=defaultDummyAccountId,
LastName='xyzzy',
Company_Plain_Text_Field__c='stringIKnowIsARealAccountName'
)
);
}
INSERT cs;
(It works fine with i < 1000
; I haven't found the exact breakpoint.)
Is there anything I can do to get a bunch of Contact records into the world of the test despite our fragile Contact triggers -- maybe simulate a batch INSERT of Contact -- so I can really stress-test the UPDATE behavior of the class I'm actually trying to design?