+ Start a Discussion
Himanshu Patel 55Himanshu Patel 55 

Test Class Error 'System.AssertException: Assertion Failed'

Hello There, I am getting Assertion Failed error in Test Class. Can you please help me to understand why getting this error. 

Thank you in advance. Below is code.

@IsTest

private with sharing class TestFastForms_GeneratePrefillLink_test{

@IsTest

  private static void testLeadTriggerViaDML()

{ Test.startTest();

Lead testLead = new Lead(FirstName  =  'Test', LastName  =  'Contact',Company='XYZ’,LeadStatus = ’Open’, Email  =  ’testlead@company.com' );

// All code in your test class is only simulated and no new records are actually created. 

// This line must be changed to create a record of your primary object. All required fields on the primary object must be included. If you have a required lookup field on this object then it must be set to the id of an existing record in your org of the object type of your lookup field.

insert testlead;

System.assert(Limits.getFutureCalls()>0);

Test.stopTest();

  }

}
 
Raj VakatiRaj Vakati
Juts trying to undertsnad Why you are checking getFutureCalls Limit from the test class .. ??? 

try this code
@IsTest

private with sharing class TestFastForms_GeneratePrefillLink_test{

@IsTest

  private static void testLeadTriggerViaDML()

{ 

Lead testLead = new Lead(FirstName  =  'Test', LastName  =  'Contact',Company='XYZ’,LeadStatus = ’Open’, Email  =  ’testlead@company.com' );

// All code in your test class is only simulated and no new records are actually created. 

// This line must be changed to create a record of your primary object. All required fields on the primary object must be included. If you have a required lookup field on this object then it must be set to the id of an existing record in your org of the object type of your lookup field.

Insert testlead;

Test.startTest();

	System.AssertEquals(testLead.FirstName ,'Test');

Test.stopTest();

  }