2

I've recently done a refactor of a org's code base and in bulk testing I initially used the dataloader to insert records, however for testing updates I decided to try using the execute anonymous tool in the developer console - mostly for ease of just copying and pasting a script in.

However I was doing with the (incorrect) assumption that execute anonymous would split the list of records into batches of 200 (I was working with 1000+ files). After a small period of concern that the changes I had made had actually reduced efficiency I realised that it wasn't doing this when comparing the limit usage and doing the same testing using the dataloader.

Now my question, with the assumption that I am correct about execute anonymous above (feel free to correct me!), what approaches do people take to bulk test their code? Would you consider dataloader insert/update etc with a batch size of 200 as sufficient? Any other approaches/considerations?

2

You can always create in bulk using loops to mass create records. A quick google produced these two articles that look worthy of review.

WRITING BULK TRIGGERS FOR SALESFORCE.COM https://developer.salesforce.com/page/An_Introduction_to_Apex_Code_Test_Methods

An Introduction to Apex Code Test Methods https://developer.salesforce.com/page/An_Introduction_to_Apex_Code_Test_Methods

The thing to focus in on is using:

for (Integer i=0; i<200; i++)

For your record creation loops.

|improve this answer|||||
1

Triggers are split into batches of 200. Governor limits apply to an entire transaction, and so loading more than 200 into an execute anonymous call will result in the triggers running more than once; it will take longer than loading records via data loader with default settings. Try setting the batch size larger in the data loader to see comparable behavior.

Regardless, you should probably try writing unit tests, which you can run without having to clean up data, and see how long the test takes to compete over several runs.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.