You need to sign in to do that
Don't have an account?
Kiru535
Help on test class code coverage
Please help me How to write test class for below one....
Functionality: Export to records in Excel file
public pageReference download()
{
List<Account> dacc1 = new List<Account>();
accountList=null;
MethCal=true;
if(accountList == null) {
for(Account a: [SELECT Name, Owner.Name, NameLocal, Id, Motorola_Customer_Number__c,Underserved_Account__c, AccountNumber,
Assigned_MR__c, Assigned_MR__r.Name,Assigned_MR__r.id, Updated_Assigned_MR__r.id,Updated_Assigned_MR__r.Name,
Primary_Served__c, Secondary_Served__c,
Updated_Primary_Served__c,Updated_Secondary_Served__c,Updated_Underserved_Account__c
FROM Account
WHERE Owner.Manager.Id =:selectedAsm AND Owner_Business_Group__c='Government'
AND RecordTypeId =:custRecordTypeId
AND (Primary_Served__c IN ('MR Led', 'MSI Led', 'Inside Sales/Tele-Sales Led')
OR Secondary_Served__c IN ('MR Led', 'MSI Led', 'Inside Sales/Tele-Sales Led'))
Order By Name])
{
dacc1.add(a);
System.debug('**********DownloadExcel**************'+dacc1.size());
}
}
downloadacc = dacc1.clone();
PageReference pageRef = new PageReference('/apex/RenderedAsExcel');
pageRef.setRedirect(false);
return pageRef;
}
Functionality: Export to records in Excel file
public pageReference download()
{
List<Account> dacc1 = new List<Account>();
accountList=null;
MethCal=true;
if(accountList == null) {
for(Account a: [SELECT Name, Owner.Name, NameLocal, Id, Motorola_Customer_Number__c,Underserved_Account__c, AccountNumber,
Assigned_MR__c, Assigned_MR__r.Name,Assigned_MR__r.id, Updated_Assigned_MR__r.id,Updated_Assigned_MR__r.Name,
Primary_Served__c, Secondary_Served__c,
Updated_Primary_Served__c,Updated_Secondary_Served__c,Updated_Underserved_Account__c
FROM Account
WHERE Owner.Manager.Id =:selectedAsm AND Owner_Business_Group__c='Government'
AND RecordTypeId =:custRecordTypeId
AND (Primary_Served__c IN ('MR Led', 'MSI Led', 'Inside Sales/Tele-Sales Led')
OR Secondary_Served__c IN ('MR Led', 'MSI Led', 'Inside Sales/Tele-Sales Led'))
Order By Name])
{
dacc1.add(a);
System.debug('**********DownloadExcel**************'+dacc1.size());
}
}
downloadacc = dacc1.clone();
PageReference pageRef = new PageReference('/apex/RenderedAsExcel');
pageRef.setRedirect(false);
return pageRef;
}
If you have any specific questions about your test, please include the test code and the issue you are facing.
NOTE: Please use the "Add a code sample" button (icon <>) to add your code to make it more readable and easier to reference.