@isTest public class CreateUpdateInvoiceStagingBatchTest { testMethod static void testCreateUpdateInvoiceStagingBatch () {
Account acct = new Account(Name='CreateUpdateInvoiceStagingBatch Test'); insert acct;
Test.startTest(); // Below line can be used to execute a batch in test class. Database.executeBatch(new CreateUpdateInvoiceStagingBatch(), 1); CreateUpdateInvoiceStagingBatch.isApexTest=false; CreateUpdateInvoiceStagingBatch.scheduleJob(); Test.stopTest(); } }
http://www.salesforce.com/us/developer/docs/apex_workbook/Content/apex_batch_2.htm
You can use following sample code:
@isTest
public class CreateUpdateInvoiceStagingBatchTest {
testMethod static void testCreateUpdateInvoiceStagingBatch () {
Account acct = new Account(Name='CreateUpdateInvoiceStagingBatch Test');
insert acct;
Test.startTest();
// Below line can be used to execute a batch in test class.
Database.executeBatch(new CreateUpdateInvoiceStagingBatch(), 1);
CreateUpdateInvoiceStagingBatch.isApexTest=false;
CreateUpdateInvoiceStagingBatch.scheduleJob();
Test.stopTest();
}
}