You need to sign in to do that
Don't have an account?
Jean-Se Dorais
Inbound Change Set - Code Coverage Error (69%)
Hello all,
I have 1 Apex Class in a change set. Everything works in Sandbox env. but when I try to bring the Class into Prod via an inbound change set, I get:
Code Coverage Failure
Your code coverage is 69%. You need at least 75% coverage to complete this deployment.
Here is my Apex Class
Any tips on how to get past this issue? I read somewhere that I need a test class in my code but I do not know how to do that.
Thank you!
I have 1 Apex Class in a change set. Everything works in Sandbox env. but when I try to bring the Class into Prod via an inbound change set, I get:
Code Coverage Failure
Your code coverage is 69%. You need at least 75% coverage to complete this deployment.
Here is my Apex Class
public class CurrentRecordIdController{ public String currentRecordId {get;set;} public String parameterValue {get;set;} public Lead lead{get;set;} public String data {get;set;} public Blob mac {get;set;} public String sig {get;set;} public String url {get;set;} public CurrentRecordIdController(ApexPages.StandardController controller) { currentRecordId = ApexPages.CurrentPage().getparameters().get('id'); lead = [Select Id, Name, Email, Company from Lead where Id =: currentRecordId ]; parameterValue = ApexPages.CurrentPage().getparameters().get('nameParam'); data = currentRecordId; mac = Crypto.generateMac('HMacSHA256', Blob.valueOf(data), Blob.valueOf('kay')); sig = EncodingUtil.urlEncode(EncodingUtil.base64Encode(mac), 'UTF-8'); url = 'https://mysite.com/123456?lid=' + currentRecordId + '&signature=' + sig; } }
Any tips on how to get past this issue? I read somewhere that I need a test class in my code but I do not know how to do that.
Thank you!
You can write the new test class as below. Just replace the word samplelead with your lead visualforce page name from your org. This will give you 100% coverage
If this solution helps, Please mark it as best answer.
Thanks,
All Answers
Can you please share the visual force page associated to this apex class with the name of the page as well.
Thanks,
You can write the new test class as below. Just replace the word samplelead with your lead visualforce page name from your org. This will give you 100% coverage
If this solution helps, Please mark it as best answer.
Thanks,