0

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:

  1. in Our test classes it is not using any database data .ie SeeAllData =false
  2. First deployment to Production . No recordtypes available
  3. 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?

2
  • are you pushing the recordtypes as part of the deployment?
    – cropredy
    Aug 15, 2017 at 0:26
  • we found the solution for it . For the system admin profile, for the account record type , we need to select person account .(in our org person account is activated ) Sep 12, 2017 at 5:18

1 Answer 1

0

Create a Contact recordtype XXXXX in Production and assign that recordtype to the Admin profile.

And rerun the test classes.

First deploy configuration related items from one package and after that deploy other components like class, pages, triggers etc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .