As we all know for production deployment , Test classes will be automatically running , right !!! . We have issue with that . Half of our test classes are failing because of access issues .
Things to note:
- in Our test classes it is not using any database data .ie SeeAllData =false
- First deployment to Production . No recordtypes available
- we are pushing admin profile in the package which have access to all the records types present.
Issue: Test class is using below statement for creating dummy record with specific record type
Schema.SObjectType.Contact.getRecordTypeInfosByName().get('XXXXX').getRecordTypeId();
Actual Issue: As our production doesn't have any recordtype test class is failing saying it unable to find the record type.
How can we fix this issue?