You need to sign in to do that
Don't have an account?
Marty Lavender
Help writing a simple unit test to validate my code
I found several articles on building a custom login controller and custom login page for SalesForce Communities. My issue now is that I am missing the 75% code coverage mark by 2 - 3% so I am unable to deploy my new controllers to Production.
I have a CustomLogin controller with the following code:
global with sharing class CustomLoginController {
global String username {get; set;}
global String password {get; set;}
global CustomLoginController () {}
global PageReference login() {
return Site.login(username, password, null);
}
}
I am needing to write a unit test that will test against this code and should get me above or at least to the 75% code coverage requirement. Can someone please help me out here?
I am extremely green when it comes to programming and I have been thrust into this role at my new job.
Thanks
I have a CustomLogin controller with the following code:
global with sharing class CustomLoginController {
global String username {get; set;}
global String password {get; set;}
global CustomLoginController () {}
global PageReference login() {
return Site.login(username, password, null);
}
}
I am needing to write a unit test that will test against this code and should get me above or at least to the 75% code coverage requirement. Can someone please help me out here?
I am extremely green when it comes to programming and I have been thrust into this role at my new job.
Thanks
All Answers
Thanks for the help.
https://developer.salesforce.com/page/An_Introduction_to_Apex_Code_Test_Methods
The test method in my previous post should give you code coverage, but I would receommend adding some assertions as well.