Which sObject type requires the test class to have the (seeAllData=true) annotation?
A developer is trying to access org data from within a test class.
Which sObject type requires the test class to have the (seeAllData=true) annotation?
A . RecordType
B. Profile
C. User
D. Report
Answer: D
Explanation:
Test (SeeAllData=true) annotation is used to grant test classes and individual test methods access to all data in the organization, including pre-existing data that the test didn’t create. This annotation is required for Apex code saved using Salesforce API version 24.0 and later.
Profile is one of the sObject types that require the isTest (SeeAllData=true) annotation to access org data from within a test class. Other sObject types that require this annotation are User, UserRole, Group, GroupMember, QueueSobject, and CronTrigger.
Therefore, using Profile as the sObject type requires the test class to have the isTest (SeeAllData=true) annotation.
Latest PDII Practice Questions with 280 Q&As
Updated Study Material | Instant Download | Detailed Answers and Explanations