Wednesday, April 5, 2017
Real Business Data Returns
Auntie Pat Tern believes you can have your cake and eat it too, "Just use your resources wisely". So I wanted to see how to use my static resources more wisely in my Salesforce org. I have previously shown how to use static resources for test data. Now, I want to use that same data in developer sandboxes created from my org. Since static resources are brought over like code to developer sandboxes, I can reference them in code I execute when I generate the sandboxes. Using the map datatype helps me keep relationships intact as well:
With this simple trick, I can preload my dev orgs with sample business data that I am using in my unit tests. Like Auntie Pat Tern promised, I can have my cake and eat it too when it comes to using realistic sample data in my tests and development orgs.
Labels:
Apex,
best practice,
CSV,
relationships,
test data,
unit test
Subscribe to:
Post Comments (Atom)
Maybe implement the SandboxPostCopy Interface so it can be automated as well.
ReplyDeletehttps://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_interface_System_SandboxPostCopy.htm
Thanks for this link!
Delete