Skip to main content

Posts

Showing posts with the label unit test

How to test Schedulable Batchable

Have you ever thought, how to test scheduled batch ? If your answer is no, because Test.startTest() and Test.stopTest() would do the job for you, you are not entirely right and you may find this article interesting. Clean the mess! For start let's define some "more-or-less" real life scenario for those, who want to follow in their orgs. We have a custom object Log ( API Name: Log__c , Name Type: Auto Number ), that we use to log exceptions, integrations and some other events worth saving. Custom object has several fields containing information like error message and stack trace, but it is not really important for our purpose. Unfortunately our predecessors (or anyone else we can easily blame) didn’t do their work properly creating immense number of bugs in the system and our object is overloaded with logged exceptions and takes too much of the storage. Fixing all the bugs in the system will take months, so we need to take care of the storage first. Our 2 000 hard-wo

About author

My photo
Jan Binder
Experienced Salesforce Technical Architect and Team Lead with a proven track record of delivering successful enterprise projects for major global companies across diverse industries, including automotive, oil & gas, and construction.