function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JVNJVN 

About Webinar: Apex Code Testing and Coverage Best Practices

Hello,

 

I want to comment something about the Testing Best Practices Webinar that you can see here:

 

http://www.youtube.com/watch?v=nMEg7e-BOTA

 

The Unit Tests showed in "23:37", "26:01" and "30:10" will fail if you run them across Salesforce interface (not by means of Eclipse Plugin). The exception will be "MIXED_DML_OPERATION". The reason is because they insert an User and Account/Opportunity in the same method (setup and non-setup objects).

 

The workaround for this exception is explained in many blogs and besides in Salesfore documentantion (for example, see http://www.iowntech.com/?p=188).

 

My question is: why the MIXED_DML_OPERATION exception is thrown when the test is runned across Salesforce interface and is not thrown when it is runned across eclipse plugin?

The main problem for us is when we are developing and running tests with eclipse, and then make an Outbound Change Set in order to deploy it to production. We spot this exception in a very bad moment :)

 

 

Thanks in advance,

across