I wrote the validation rule to restrict the custom field picklist value it many test classes is getting failed because of that where and what line i can add into picklist value to cover the test coverage. lets say there are 4 insert statement for that object so do i need to add my code 4 time?

  • 2
    short answer is yes. Whenever you are inserting that object record you need to update code and need to give correct values. Dec 21 '17 at 5:56

As i am trying to create one testusercreate class then i can call this class into my test classe which all are getting failed i am trying public class

CreateTestUser {
    public class userTest {    
   Profile profileId = [SELECT Id FROM Profile WHERE Name = 'Standard User' LIMIT 1];
     User usr = new User(LastName = 'LIVESTON',


                           Alias = 'jliv',

                           Email = 'jason.liveston@asdf.com',

                           Username = 'jason.liveston@asdf.com',

                           ProfileId = profileId.id,

                           TimeZoneSidKey = 'GMT',

                           LanguageLocaleKey = 'en_US',

                           EmailEncodingKey = 'UTF-8',

                           LocaleSidKey = 'en_US',

                          Resource_Type__c ='Employee');                    

                Return User;                     

please correct me if i m not going in right direction

  • you can edit your question and update the description instead of verifying the details in answer. Dec 22 '17 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.