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.

Set global values for the test factory

Set global values for the test factory - Salesforce Tutorial

From the course: Introduction to Test Classes in Salesforce

Start my 1-month free trial

Set global values for the test factory

- [Instructor] As we're getting ready to start fleshing out the details of our test factory, there's a few things that we need to do in advance. First one we need to define some global constants. These are values that are not going to change in our org, that we need to have available to us as we're creating the test, and creating the various objects in our test factory. First thing we're going to look at is record types. Obviously the more complex the org is the more record types you're going to have, and you're going to have code that's dependent upon those record types. So we're going to need to be able to test those. Instead of having every test method query for those particular record types, we're going to use them as global constants. And as you can see here in line 5 through 7, we have set up a customer account. In that customer account we're going to query and return the record type for the customer. We also have one for business, so in our org we have basically two record…

Contents