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
Kirill YunussovKirill Yunussov 

Test class does not run in UI, but completes in IDE - what is its true coverage?

Some test classes you cannot run through UI, but can through IDE.   How do such test classes affect the total code coverage percentage for the org?   Are they seen as having 0% coverage, or whatever the IDE says they cover (95% for example)?

 

 MIXED_DML_OPERATION, DML operation on setup object is not permitted Error

Rahul_sgRahul_sg
in the UI with the new release its not showing code coverage this is an issue and SFDC is working on it. However, if you see MIXED_DML_OPERATION then you will have to fix your test class. Eclipse ide doen not detect this error.

Just use runAs in your test method , this will fix the issue.

Once there are no errors then you can refer to eclipse or console for actual code coverage.
sandeep@Salesforcesandeep@Salesforce

1. It existing differnece between code coverage calcuator of Saleforce UI and IDE plug in. UI  should be considered correctly.

2. MIXED_DML_OPERATION error is coming as you are trying to insert setup and non setup objects in single flow.

Subhani PSubhani P

+ Sandeep suggestion,

 

A "setup" object is one that must be edited from the setup or builder area of the platform. These object include the User object, Ogranization object, Email templates and so on.


See this article for details DML operations of a non-setup sObject and a setup sObject

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_dml_non_mix_sobjects.htm?SearchType=Stem

 

 

Thanks,
Subhani,
Salesforce Certified Developer,
www.mydbsync.com