You need to sign in to do that
Don't have an account?
Bryan Jimenez 5
I keep getting this error when validating in production.
System.AssertException: Assertion Failed
Stack Trace: Class.ContactExtensionTest.ContactExtensionTest: line 8, column 1
Help with simple CONTACT apex test
Hi all,
I am currently trying to create a test for my controller. The test I have currently gives me 100% in salesforce but it fails on validation to production.
What am i doing wrong?
public class ContactExtension { public ContactExtension(ApexPages.StandardController controller) { Contact C = (Contact)controller.getRecord(); C.Recordtypeid = '012d0000001cltE'; } } @istest(seeAllData='true') public class ContactExtensionTest { public static testMethod void ContactExtensionTest() { Contact Con = new Contact(); ApexPages.StandardController controller = new ApexPages.StandardController(Con); ContactExtension extension = new ContactExtension(controller); System.assert(Con.Firstname !=Null); } }
I keep getting this error when validating in production.
System.AssertException: Assertion Failed
Stack Trace: Class.ContactExtensionTest.ContactExtensionTest: line 8, column 1
Please try below post to learn about test classes
1) http://amitsalesforce.blogspot.com/search/label/Test%20Class
2) http://amitsalesforce.blogspot.com/2015/06/best-practice-for-test-classes-sample.html
Please update your code like below
Let us know if this will help you
All Answers
Please try below post to learn about test classes
1) http://amitsalesforce.blogspot.com/search/label/Test%20Class
2) http://amitsalesforce.blogspot.com/2015/06/best-practice-for-test-classes-sample.html
Please update your code like below
Let us know if this will help you