@isTest
public class CreateAccountTest
{
static testMethod void testInsertAccount()
{
pagereference pa = new pagereference();
pa.pagereference(‘TestclassAcc1’);
}
}
Hi llisa this one also with code coverage check it once....
@isTest
public class pagereference
{
static testMethod void testpagereference()
{
pagereference pa = new pagereference();
// pa.pagereference (‘pagereference1’);
}
}
public static testMethod void testmycontroller() { PageReference pageRef = Page.KDashboardExportToExcel; Test.setCurrentPage(pageRef); controller.add();//in place of add put function name }
this is your test class and nobody here can explain you with correct test class without getting your apex class code because everybody will have following questions
1. Is it standard controller or custom controller. 2. if it standard controller what is the sobject type. 3. is it static class ?
So please post your apex class code and then you can ask for explanation.
Above code should work for you.
Thanks,
Himanshu
Thanks for your reply.But this code ic not working.
If you are new to SFDC it would be great if you can post your class constructor and class name so that I can explain you with correct way.
Thanks,
Himanshu
my code is
public static testMethod void testmycontroller() {
PageReference pageRef = Page.KDashboardExportToExcel;
Test.setCurrentPage(pageRef);
controller.add();//in place of add put function name
}
this is your test class and nobody here can explain you with correct test class without getting your apex class code because everybody will have following questions
1. Is it standard controller or custom controller.
2. if it standard controller what is the sobject type.
3. is it static class ?
So please post your apex class code and then you can ask for explanation.
Makes sense ?