PDII practice question 9 of 10

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?

Full set: 198 questions
Answer options
A: User
B: RecordType
C: Report Correct answer
D: Profile
Correct Answer:
C. Report
Explanation

By default, Apex test classes are isolated from organizational data to ensure tests are independent and repeatable. However, some setup and metadata objects function as exceptions and are always accessible without the @isTest(SeeAllData=true) annotation. User, Profile, and RecordType belong to this category of setup objects. The Report sObject, however, is not classified as a globally accessible setup object. Furthermore, because Report records cannot be created using standard Apex Data Manipulation Language (DML) statements, the only way a test class can query and access existing Report records from the organization is by explicitly annotating the test class or test method with @isTest(SeeAllData=true).

Why Incorrect

A. User: Incorrect because User is a setup object that is automatically visible to test classes without special annotations.
B. RecordType: Incorrect because RecordType is universally accessible in test contexts without requiring the SeeAllData annotation.
D. Profile: Incorrect because Profile is a setup object and is persistently available to unit tests without requiring the SeeAllData annotation.

References

Salesforce Apex Developer Guide, "Isolation of Test Data from Organization Data in Unit Tests" (Section: Objects That Are Not Isolated).

Salesforce Apex Developer Guide, "Using the isTest(SeeAllData=True) Annotation".

Scroll to Top