I have many custom objects with lots of relationships and i want to create some test data for my test classes. For example, i have the Objects Account Opportunity Basket Product Configuration Product Definition Attribute
What is the best way in order to create test data for those Objects. I am thinking to do the following:
- Create test data in csv files for each object as independent records
- Upload the files as static resources in my sandbox
- Inside my test Apex class load the Accounts static resource
- Then, load the opportunities static resource and after loading them, set the Accounts as parents and update the opportunities.
- Load the bsaket data and set the opportunity id field to the respective opportunities.
Is this a best practice? Is there maybe a "quicker" road to this?