You need to sign in to do that
Don't have an account?
Abhishek Tiwari 25
zero coverage
I am facing coverage issue in my test class,please suggest
CLASS
public class SurveyDetailViewPage {
String Id;
public Survey_Mcd__c smc;
public SurveyDetailViewPage(ApexPages.StandardController controller) {
Id = ApexPages.Currentpage().getParameters().get('id');
this.smc = (Survey_Mcd__c)controller.getRecord();
}
}
TEST CLASS
@isTest
private class TestsurveydetailViewPage {
static testMethod void myUnitTest1() {
Test.startTest();
Survey_Mcd__c smc = new Survey_Mcd__c();
smc.Survey_Name__c = 'McDonald';
smc.Question__c = 'Test';
smc.X5_Scale_Rating__c = false;
insert smc;
List<Survey_Mcd__c> smcRecord = new List<Survey_Mcd__c>();
smcRecord = [Select Id From Survey_Mcd__c where Id=:smc.Id LIMIT 1];
if(smcRecord.size()>0)
ApexPages.Currentpage().getParameters().put('id',smcRecord.get(0).Id);
Test.stopTest();
}
}
CLASS
public class SurveyDetailViewPage {
String Id;
public Survey_Mcd__c smc;
public SurveyDetailViewPage(ApexPages.StandardController controller) {
Id = ApexPages.Currentpage().getParameters().get('id');
this.smc = (Survey_Mcd__c)controller.getRecord();
}
}
TEST CLASS
@isTest
private class TestsurveydetailViewPage {
static testMethod void myUnitTest1() {
Test.startTest();
Survey_Mcd__c smc = new Survey_Mcd__c();
smc.Survey_Name__c = 'McDonald';
smc.Question__c = 'Test';
smc.X5_Scale_Rating__c = false;
insert smc;
List<Survey_Mcd__c> smcRecord = new List<Survey_Mcd__c>();
smcRecord = [Select Id From Survey_Mcd__c where Id=:smc.Id LIMIT 1];
if(smcRecord.size()>0)
ApexPages.Currentpage().getParameters().put('id',smcRecord.get(0).Id);
Test.stopTest();
}
}
Please check once below code :
Hope this helps you!
Thanks
Varaprasad
For Support: varaprasad4sfdc@gmail.com
All Answers
Please check once below code :
Hope this helps you!
Thanks
Varaprasad
For Support: varaprasad4sfdc@gmail.com