function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ifthikar Ahmed 1ifthikar Ahmed 1 

which feature allow a developer to create test record

User-added image
Best Answer chosen by ifthikar Ahmed 1
v varaprasadv varaprasad
Hi Ahmed,

ANS: Static Resources.

Loading Test Data :

Using the Test.loadData method, you can populate data in your test methods without having to write many lines of code.

Follow these steps:
  1. Add the data in a .csv file.
  2. Create a static resource for this file.
  3. Call Test.loadData within your test method and passing it the sObject type token and the static resource name.
For example, for Account records and a static resource name of myResource, make the following call:
List<sObject> ls = Test.loadData(Account.sObjectType, 'myResource');

More info : https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_load_data.htm



Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.


Salesforce Freelance Consultant/Developer/Administrator/Trainer
@For Salesforce Project Support: salesforcestart1@gmail.com

Salesforce latest interview questions and training videos :
https://www.youtube.com/channel/UCOcam_Hb4KjeBdYJlJWV_ZA?sub_confirmation=1


Thanks,
V Varaprasad
Email: salesforcestart1@gmail.com​​​​​​​

All Answers

Nubes Elite Technologies Pvt. LtdNubes Elite Technologies Pvt. Ltd
Hi Ifthikar,

Correct answer is (A) Static Resources.

Thank You,
www.nubeselite.com
Development | Training | Consulting

Please mark this as solution if your problem is solved.
v varaprasadv varaprasad
Hi Ahmed,

ANS: Static Resources.

Loading Test Data :

Using the Test.loadData method, you can populate data in your test methods without having to write many lines of code.

Follow these steps:
  1. Add the data in a .csv file.
  2. Create a static resource for this file.
  3. Call Test.loadData within your test method and passing it the sObject type token and the static resource name.
For example, for Account records and a static resource name of myResource, make the following call:
List<sObject> ls = Test.loadData(Account.sObjectType, 'myResource');

More info : https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_load_data.htm



Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.


Salesforce Freelance Consultant/Developer/Administrator/Trainer
@For Salesforce Project Support: salesforcestart1@gmail.com

Salesforce latest interview questions and training videos :
https://www.youtube.com/channel/UCOcam_Hb4KjeBdYJlJWV_ZA?sub_confirmation=1


Thanks,
V Varaprasad
Email: salesforcestart1@gmail.com​​​​​​​
This was selected as the best answer