You need to sign in to do that
Don't have an account?
sruthi.458
need help on test code
hi
i write a test code for batch apex for deleteing multiple records for at a time
@istest
public class testc1
{
public static testmethod void c11()
{
integer bc=[select count() from lead where company='ibm'];
if(bc>0)
{
delete d= new delete('select id from lead where company=ibm');
id batchinstanceid=database.executebatch(d,10);
}
integer ac=[select count() from lead where company='ibm'];
system.assertequals(0,ac);
}
}
public class testc1
{
public static testmethod void c11()
{
integer bc=[select count() from lead where company='ibm'];
if(bc>0)
{
delete d= new delete('select id from lead where company=ibm');
id batchinstanceid=database.executebatch(d,10);
}
integer ac=[select count() from lead where company='ibm'];
system.assertequals(0,ac);
}
}
i have a doubt an where to mention delete
can u fix it a solution
Regards,
Srikanth
Hi friends,
can anyone suggest for solution.
Regards,
Srikanth
static testMethod void testCase1() {
Test.startTest();
[.....add the below code after your code]
String str = 'Select ID,Name from myobject__c';
MyBatch mybatch = new HanroOfferSendingBatch('');
mybatch .query = str;
ID batchprocessid = Database.executeBatch(mybatch );
Test.stopTest();
}
public static testMethod void testCase2(){
Test.startTest();
MyBatchScheduler schTest = new MyBatchScheduler();
string sch = '0 0 0 3 9 ? 2022';
system.schedule('BatchTest',sch,schTest);
Test.stopTest();
}
cheers
suresh