You need to sign in to do that
Don't have an account?
Ad_Infosys
Too many SOQL in test coverage
I am facing a show stopper problem.
I ahve developed an apex code in Apex classes. These classes have methods which are called between each other. Each class has several number of SOQLs but in a particular context only few are executed(This is well in limit of 100 SOQLs)
Now when I create the code coverage, I have to have cummulative coverage. In test coverage while covering scenerios I get across Too many SOQL 101. I am struck at 60% code coverage.
Kindly suggest me a way out. This hidrance wont allow codes to move to Production.
Have you reviewed the Apex documentation to ensure that you are following the recommended guidelines for governor limations (i.e. do not make SOQL calls within a loop)? Keep in mind that, since your triggers seem to fire each other to some extent, TriggerA may not have SOQL within a loop, but TriggerA could be calling TriggerB within a loop where TriggerB executes a SOQL call (thus executing TriggerB's SOQL call multiple times with a single execution of TriggerA).
//opda = GetPipelineFilter_Crdt_AT.GetPipeline_CreatdtAT(adid,Ftype,Frmdt,todt,stype,sorder);
}
else if(Ftype=='Scheduled Close Date'){
//opda = GetPipelineFilter_Cldt_AT.GetPipeline_ClosedtAT(adid,Ftype,Frmdt,todt,stype,sorder);
}
else if(Ftype=='Last Modified Date'){
//opda = GetPipelineFilter_Modt_AT.GetPipeline_ModifdtAT(adid,Ftype,Frmdt,todt,stype,sorder);
}
/* If no Filter criteria is specified */
else{
/* Check the sorting criteria specified by the user and further check the sorting order to manipulate the result extracted. Select the open tasks, take out the opportunities, contacts from opportunitycontactrole and tasks */
if(stype =='Applicant Name'){
if(sorder =='desc'){
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by name desc nulls last];
}
else{
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by name asc nulls last];
}
}
else if(stype =='Application Number'){
if(sorder =='desc'){
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by Application_Number__c desc nulls last];
}
else{
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by Application_Number__c asc nulls last];
}
}
else if(stype =='Home Phone Number'){
if(sorder =='desc'){
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by Home_Phone__c desc nulls last];
}
else{
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by Home_Phone__c asc nulls last];
}
}
else if(stype =='# of pending'){
if(sorder =='desc'){
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by outstanding_stips__c desc nulls last];
}
else{
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by outstanding_stips__c asc nulls last];
}
}
else if(stype =='Closing State'){
if(sorder =='desc'){
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by State__c desc nulls last];
}
else{
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by State__c asc nulls last];
}
}
else if(stype =='Best Contact Time'){
if(sorder =='desc'){
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by Best_Time_to_Contact__c desc nulls last];
}
else{
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by Best_Time_to_Contact__c asc nulls last];
}
}
else if(stype =='Best Contact Method'){
if(sorder =='desc'){
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by best_method_of_contact__c desc nulls last];
}
else{
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by best_method_of_contact__c asc nulls last];
}
}
else if(stype =='Contact Email'){
if(sorder =='desc'){
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by contact_email__c desc nulls last];
}
else{
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by contact_email__c asc nulls last];
}
}
else if(stype =='Cell Number'){
if(sorder =='desc'){
opda.optec=[select Name from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by otherphone__c desc nulls last];
}
else{
opda.optec=[select Name, from Obj_application_data__c where AppTaker_AdEnt_Id__c=:adid and islatest__c=true and Application_Entry_Date__c>=Last_month order by otherphone__c asc nulls last];
}
}