Sample Code:
Employee__c emp = new Employee__c(Employee_Name__c = ‘Testsing’);
insert emp;
Test.setCreatedDate(emp.Id, DateTime.newInstance(2000,10,10));
Check the below link for more information
Cheers!!!