The Test.loadData() method would be a great method to utilize to get rid of test setup code in our package. However, we have many objects that are related to each other through lookups and master-detail fields.
Test.loadData() does not support specifying an External Id when loading test data. This makes this method less than ideal for us. The solution posted at http://help.salesforce.com/apex/HTViewSolution?id=000167032&language=en_US
provides an example that assigns lookups through code. We want to eliminate code, not write more code.
In addition, loading test data through the Test.loadData() method when there is a required Master-Detail lookup on an object is impossible, as that field is required and there's no way to set it.
Allow us to specify an External Id column in the CSV file.
Say we have a custom "Order__c" object with a Master-Detail lookup to an Account. The CSV files would look something like this:
Order__c CSV File:
Account CSV File: