How to write test class for Batch Apex in Salesforce ?

We should always test batch class with good amount of data (minimum 200 records) in our test class. Here is the example of batch apex testing. In below code, we are updating name of all accounts with “Updated” keyword in the last of account name. Batch Class: global class AccountUpdate implements Database.Batchable { global Database.QueryLocator…

How do we write a Batch Class in APEX and schedule it to run?

Scenario We need to look at all Accounts and update the related Contacts description with Rating field from respective Account. e.g. “Account rating is Cold” Why Batch Apex ? Batch Apex is used to process high volume of records and it allows us to run their code on a specific time. In batch APEX there is the…