[SalesForce] Generating Real World Type Data

How does one generate real world type data and populate Salesforce test instances with this data that may be needed for testing? Does Salesforce provide any services to generate/provide this type of data if one's own production org does not have it currently? I am assuming that I have created/purchased a new sandbox and it needs to be populated.


Best Answer

Quite often I just end up cannibalizing code snippets from my unit tests ;)

The more effort you'll put into making unit tests that don't rely on existing data and attempt to test in bulk loads (200+ Accounts for example), the less trouble you have later when you need to "prime" a blank sandbox.

In the end you know your data best. If you can extract meaningful slices from production (and load them to sandbox keeping referential integrity... External Id fields are good for that) - awesome. If not - there will be only so much you can squeeze from dummy data generators and the chance is you already have some well-written unit tests.

If the size of data needed is huge and you won't be able to load it all in 1 transaction you could even end up having a class that you'd use only in sandboxes (it'd never be deployed to production). Split the created data into several methods, call each in separate transaction and you're done.

Related Topic