You need to sign in to do that
Don't have an account?
Hema!
class for test
i covered 62% help me public class mySecondController { Account account; public Account getAccount() { if(account == null) account = new Account(); return account; } public PageReference save() { // Add the account to the database. insert account; // Send the user to the detail page for the new account. PageReference acctPage = new ApexPages.StandardController(account).view(); acctPage.setRedirect(true); return acctPage; } } ======================= @isTest private class mySecondController_Test{ static testMethod void test_getAccount_UseCase1(){ mySecondController obj01 = new mySecondController(); obj01.getAccount(); } static testMethod void test_save_UseCase1(){ mySecondController obj01 = new mySecondController(); obj01.save(); } } Thanks in Advance
All Answers
@isTest
private class mySecondController_Test{
static testMethod void test_getAccount_UseCase1(){
mySecondController obj01 = new mySecondController();
obj01.getAccount();
}
static testMethod void test_save_UseCase1(){
Account obj = new Account(Name = 'TestAcc');
insert obj;
mySecondController obj01 = new mySecondController();
Pagerefernce pageRef = new Pagereference('/'+obj.id);
Test.setCurrentPage(pageRef);
obj01.save();
}
}