top of page

To load test data using csv file

Save the csv file as a static resource.

In the test class, use the method:

List<sObject> ls = Test.loadData(<ObjectType>.sObjectType,'<name of the static resource>');


To use the data:

for(<sObject> obj : ls){

//code

}

Recent Posts

See All
Data loader for bulk testing

The data loader is used to insert, update, or delete large amounts of data at once. This is great for bulk testing parts of your code...

 
 
 
Best Practices for Unit testing

Unit tests are class methods that verify whether a particular piece of code is working properly. Unit test methods take no arguments,...

 
 
 
Steps in Unit Testing

Create test data Call the Apex class method in the test method Verify results using System.asserts or assertequals

 
 
 

Comments


Post: Blog2_Post

©2020 by SalesforceDemystified. Proudly created with Wix.com

bottom of page