Newer Version Available

This content describes an older version of this product. View Latest

Work with Data

Development environments, such as scratch orgs and developer sandboxes, need a set of stock data for testing.

Sometimes, the stock data in a development environment doesn’t meet your development needs. Apex tests generally create their own data. Therefore, if Apex tests are the only tests you’re running in a scratch org, you probably don’t need to worry about data for the time being. However, other tests, such as UI, API, or user acceptance tests, do need baseline data. Scale and performance testing often requires a very large set of data. Make sure that you use consistent datasets when you run tests of each type.

Scratch orgs come with the same set of data as the edition on which they’re based. For example, Developer Edition orgs typically include 10–15 records for key standard objects, such as Account, Contact, and Lead. These records come in handy when you’re testing something like a new Apex trigger, flow, or Lightning web component.

The following sections describe the Salesforce CLI commands you can use to populate your orgs and provide basic usage examples. The commands you use depend on your current stage of development.