Back to Browse

Create Test Data for Apex Tests | Apex Testing

6.3K views
Nov 1, 2022
5:08

#salesforce #trailhead #salestraining Create Test Data for Apex Tests Create a Contact Test Factory Create an Apex class that returns a list of contacts based on two incoming parameters: the number of contacts to generate and the last name. Do not insert the generated contact records into the database. NOTE: For the purposes of verifying this hands-on challenge, don't specify the @isTest annotation for either the class or the method, even though it's usually required. Create an Apex class in the public scope Name: RandomContactFactory (without the @isTest annotation) Use a Public Static Method to consistently generate contacts with unique first names based on the iterated number in the format Test 1, Test 2 and so on. Method Name: generateRandomContacts (without the @isTest annotation) Parameter 1: An integer that controls the number of contacts being generated with unique first names Parameter 2: A string containing the last name of the contacts Return Type: List Contact 00:00 Introduction 00:32 Apex CLass 03:54 Coadding View

Download

0 formats

No download links available.

Create Test Data for Apex Tests | Apex Testing | NatokHD