From the course: Introduction to Test Classes in Salesforce

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Customize a test factory

Customize a test factory - Salesforce Tutorial

From the course: Introduction to Test Classes in Salesforce

Start my 1-month free trial

Customize a test factory

- [Instructor] Now that we've got our global constants set, we've set up our global utilities, we've set up all of the basic parts of the test factory. This is where we start customizing the test factory to match our organization. We're going to need to create a public class for each of the objects that we have in our system. For example, we've got an account, so we need AccountDefaults. We have a contact so we need a ContactDefaults. And what's unique here is the way in which this is mapped. So we're going to have the name of the field, for example, Name, and it's going to have a value of Test Account, you'll follow the syntax throughout, it's pretty straightforward. BillingCity going to choose a city, Portland. If we have a custom field like Category, the custom field name remember always has the __c attached to the name. So we're going to put that here, and then we're going to give it the category name. The global constants that we specified earlier, that's where these start to…

Contents