Hi,
I have wrote a batch class and now i am writing test class for it but i am getting this error. Argument must be an object that implements Database.Batchable
Batch class
global class CBatchCalculateRatingsHistoricalData
{
// Persistent variables
global Boolean hasErrors {get; private set;}
// Constructor
global CBatchCalculateRatingsHistoricalData()
{
this.hasErrors = false;
}
global Database.QueryLocator start(Database.BatchableContext BC)
{
system.debug('Processing start method');
// Query string for batch Apex
String query = '';
query += 'SELECT Id,name,Date_of_First_Order__c,Number_of_Orders__c FROM Account ';
if(system.Test.isRunningTest())
query += ' LIMIT 200';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<sObject> objectBatch)
{
}
global void finish(Database.BatchableContext BC)
{
}
}test class
@isTest(seeAllData = true)
public class scheduledBatchable
{
static testMethod void Test_CBatchRatingsHistory()
{
System.Test.startTest();
CBatchCalculateRatingsHistoricalData b = new CBatchCalculateRatingsHistoricalData();
Database.executeBatch(b, 200);
System.Test.stopTest();
}
}please tell me what is the issue with this code. If i am wrong then please help me to get it right.
Thanks
Anu