A developer needs to have records with specific field values in order to test a new Apex class.
What should the developer do to ensure the data is available to the test?
Use SOQL to query the org for the required data.
Use Test.loadData() and reference a CSV file in a static resource.
Use Anonymous Apex to create the required data.
Use Test. loadData() and reference a JSON file in Documents.
WhyTest.loadData()?
Simplifies test data creation by loading data from a CSV file stored as a static resource.
Ideal for testing specific field values in bulk.
Why Not Other Options?
A: Querying data from the org violates test isolation principles.
C: Anonymous Apex cannot be used within test classes.
D: JSON files in Documents are not supported byTest.loadData().
Submit