Activity › Forums › Salesforce® Discussions › How to insert password in apex test class of Salesforce? Salesforce® Discussions How to insert password in apex test class of Salesforce? Posted by Aditya on July 20, 2020 at 4:09 PM How to insert password in apex test class of Salesforce? Mallika replied 5 years, 10 months ago 2 Members · 1 Reply 1 Reply Mallika Member July 21, 2020 at 6:11 AM Hi Aditya, Try this code. Hope it helps! @isTest public class SampleTest { public static testMethod void LoginFail() { Sample tp=new Sample (); tp.loginPage(); } public static testMethod void loginPass() { Account acc = new Account(); acc.Name ='mecrin'; acc.sic = '12345'; insert acc; Sample tp=new Sample (); tp.userName ='mecrin'; tp.password ='12345'; tp.loginPage(); } } Log In to reply. Public All Members My Connections Only Me PublicAll MembersMy ConnectionsOnly Me Public All Members My Connections Only Me