when I am executing my unit test for the apex class
"salesforce No more than one executeBatch can be called from within a test method. Please make sure the iterable returned from your start method matches the batch size, resulting in one executeBatch invocation."
@isTest
public class PWQuartertionconts_Test {
@isTest static void testQuar() {
Test.StartTest();
par_f pf=new par_f();
pf.name='Test12';
pf.Current_Units_in_Fund_num=100;
pf.Total_Capital_Contributed=66;
pf.Capital_Redemptions_of_All_Investors=33;
insert pf;
system.debug('pf'+pf);
Qua_Dis qd=new Qua_Dis();
qd.Pref_Dis=1;
qd.Prof_Dis=1;
qd.Purchase_Price_Per_Unit=1;
qd.Quarter='Q1';
qd.Year='2016';
qd.par_f=pf.id;
insert qd;
system.debug('qd'+qd);
RecordType rt1 = [Select Id,Name From RecordType Where Name = 'Investor Partner' And SobjectType = 'cont'];
cont ct=new cont();
ct.Membership_In='PICR Fund III L.P.';
ct.LastName='test30';
ct.RecordTypeId=rt1.Id;
ct.par_f = pf.Id;
ct.Units_In_Fund=222;
ct.cont_Types='PICR Investor';
ct.Distribution_Type='Distribution';
ct.cont_Type='Investor';
/*ct.Investment_Cost_Basis=550;
ct.Total_Redemptions=112;
ct.Total_Distributions=639;
ct.par_f__r.Total_Capital_Contributed=256;
ct.par_f__r.Capital_Redemptions_of_All_Investors=356;*/
insert ct;
system.debug('ct'+ct);
Prof_Dis prof=new Prof_Dis();
prof.Investor_Name=ct.Id;
prof.Status='calculated';
prof.Qua_Dis_Name=qd.Id;
prof.Share_Percentage=1;
prof.Share_Amount=1;
prof.Quarter=qd.Quarter;
prof.Year=qd.Year;
insert prof;
system.debug('prof'+prof);
Pref_Dis pref = new Pref_Dis();
pref.Investor_Name=ct.Id;
pref.Status='calculated';
pref.Qua_Dis_Name=qd.Id;
pref.Share_Percentage=1;
pref.Share_Amount=1;
pref.Quarter=qd.Quarter;
pref.Year=qd.Year;
insert pref;
system.debug('pref'+pref);
Apexpages.StandardController stdController = new Apexpages.StandardController(qd);
PWQuarterlyDistributionconts cont = new PWQuarterlyDistributionconts(stdController);
cont.QDD();
Test.StopTest();
}
public static testMethod void testcapibution() {
Test.StartTest();
par_f pf2=new par_f();
pf2.name='test99';
pf2.Current_Units_in_Fund_num=10;
pf2.Total_Capital_Contributed=63;
pf2.Capital_Redemptions_of_All_Investors=32;
insert pf2;
system.debug('pf2'+pf2);
Qua_Dis qd2=new Qua_Dis();
qd2.Pref_Dis=1;
qd2.Prof_Dis=1;
qd2.Purchase_Price_Per_Unit=1;
qd2.Quarter='Q2';
qd2.Year='2016';
qd2.par_f=pf2.id;
insert qd2;
system.debug('qd'+qd2);
RecordType rt2 = [Select Id,Name From RecordType Where Name = 'Investor Partner' And SobjectType = 'cont'];
cont ct2=new cont();
ct2.Membership_In='PICR Fund III L.P.';
ct2.LastName='test30';
ct2.RecordTypeId=rt2.Id;
ct2.par_f = pf2.Id;
ct2.Units_In_Fund=222;
ct2.cont_Types='PICR Investor';
ct2.Distribution_Type='Reinvestment';
ct2.cont_Type='Investor';
insert ct2;
RecordType rt3 = [Select Id,Name From RecordType Where Name = 'Investor Partner' And SobjectType = 'cont'];
cont ct3=new cont();
ct3.Membership_In='PICR Fund III L.P.';
ct3.LastName='test31';
ct3.RecordTypeId=rt3.Id;
ct3.par_f = pf2.Id;
ct3.Units_In_Fund=222;
ct3.cont_Types='PICR Investor';
ct3.Distribution_Type='Distribution';
ct3.cont_Type='Investor';
insert ct3;
Prof_Dis prof2=new Prof_Dis();
prof2.Investor_Name=ct2.Id;
prof2.Status='calculated';
prof2.Qua_Dis_Name=qd2.Id;
prof2.Share_Percentage=1;
prof2.Share_Amount=1;
prof2.Quarter=qd2.Quarter;
prof2.Year=qd2.Year;
prof2.Distribution_Type=ct2.Distribution_Type;
insert prof2;
system.debug('prof2'+prof2);
Pref_Dis pref = new Pref_Dis();
pref.Investor_Name=ct2.Id;
pref.Status='calculated';
pref.Qua_Dis_Name=qd2.Id;
pref.Share_Percentage=1;
pref.Share_Amount=1;
pref.Quarter=qd2.Quarter;
pref.Year=qd2.Year;
pref.DistributionType=ct2.Distribution_Type;
insert pref;
Prof_Dis prof3=new Prof_Dis();
prof3.Investor_Name=ct3.Id;
prof3.Status='calculated';
prof3.Qua_Dis_Name=qd2.Id;
prof3.Share_Percentage=1;
prof3.Share_Amount=1;
prof3.Quarter=qd2.Quarter;
prof3.Year=qd2.Year;
prof3.Distribution_Type=ct3.Distribution_Type;
insert prof3;
system.debug('prof2'+prof2);
Pref_Dis pref2 = new Pref_Dis();
pref2.Investor_Name=ct3.Id;
pref2.Status='calculated';
pref2.Qua_Dis_Name=qd2.Id;
pref2.Share_Percentage=1;
pref2.Share_Amount=1;
pref2.Quarter=qd2.Quarter;
pref2.Year=qd2.Year;
pref2.DistributionType=ct3.Distribution_Type;
insert pref2;
RecordType c2 = [Select Id,Name From RecordType Where Name = 'Contribution' And SobjectType = 'Capl_C'];
Capl_C df= new Capl_C();
df.RecordTypeId=c2.Id;
df.Type='Preferred Distribution Reinvestment';
df.Type='Profit Distribution Reinvestment';
df.par_f=pf2.Id;
df.Contribution_Amount=1000;
//df.Redemption_Amount=5000;
df.Investor_cont=prof2.Investor_Name;
df.Date=Date.newInstance(2016,08,02);
df.Purchase_Price_Per_Unit=qd2.Purchase_Price_Per_Unit;
df.Prof_Dis_ID=prof2.Id;
df.Preffered_Distribution_ID=pref.Id;
insert df;
Capl_D cdd=new Capl_D();
cdd.Investor_cont=prof3.Investor_Name;
cdd.Quarter=prof3.Quarter;
cdd.Year=prof3.Year;
cdd.Prof_Dis_ID=prof3.Id;
cdd.Distribution_Date=Date.newInstance(2016,08,02);
cdd.Distribution_Amount=prof3.Share_Amount;
cdd.Description='Profit Distribution';
cdd.From_par_f=prof3.Qua_Dis_Name__r.par_f;
cdd.Investor_cont=pref2.Investor_Name;
cdd.Quarter=pref2.Quarter;
cdd.Year=pref2.Year;
cdd.Pref_Dis_ID=pref2.Id;
cdd.Distribution_Date=Date.newInstance(2016,08,02);
cdd.Distribution_Amount=pref2.Share_Amount;
cdd.Description='Preferred Distribution';
cdd.From_par_f=pref2.Qua_Dis_Name__r.par_f;
insert cdd;
Apexpages.StandardController stdController2 = new Apexpages.StandardController(qd2);
PWQuarterlyDistributionconts cont = new PWQuarterlyDistributionconts(stdController2);
cont.capitaldistribution();
Test.StopTest();
}
}
i am getting above error.