You need to sign in to do that
Don't have an account?
Apex Class to redirect a page.
Hi,
I have this class and am trying to deploy but getting error "Average test coverage across all Apex Classes and Triggers is 70%, at least 75% test coverage is required".
Below I am pasting my code. Any assistance is helpful
public class MigrationExtension {
private final Lead migrationlead;
public MigrationExtension(ApexPages.StandardController
stdController) {
migrationlead = (Lead)stdController.getRecord();
}
public PageReference saveLead() {
try {
insert(migrationlead);
}
catch(System.DMLException e) {
ApexPages.addMessages(e);
return null;
}
PageReference p = Page.ThankMigration;
p.setRedirect(true);
return p;
}
}
I was able to create a Test extension for this and was able to bring both the Extension and Test Extension over.
Thanks
All Answers
Hello,
well dude you have to write the test method for this class. When ever you deploy your code your trigger and class code coverage must be more than all equal to 75%. I can write the test method here but want you to write this, so than in future you will know how to write this. So please go through the docs of how to write the test method.
Hi Ashish,
I am new to this, but I gave it a shot and still getting the error.
I was able to create a Test extension for this and was able to bring both the Extension and Test Extension over.
Thanks