nerdexam
Salesforce

PDII · Question #68

A developer needs test data for Apex test classes. What can the developer use to provide test data to the test methods? (Choose two.)

The correct answer is A. List<sObject> Is = Test.loadData (Lead.sObjectType, 'myTestLeads'); B. myDataFactory.createTestRecords (10). See the full explanation below for the reasoning.

Question

A developer needs test data for Apex test classes. What can the developer use to provide test data to the test methods? (Choose two.)

Options

  • AList<sObject> Is = Test.loadData (Lead.sObjectType, 'myTestLeads');
  • BmyDataFactory.createTestRecords (10)
  • CDatabase.createTestRecords (10)
  • DList<sObject> Is = Test.loadDat (Lead.sObjectType, $Resource + 'myTestLeads');

How the community answered

(34 responses)
  • A
    71% (24)
  • C
    21% (7)
  • D
    9% (3)

Community Discussion

No community discussion yet for this question.

Full PDII Practice