+ Start a Discussion
SFDCDevQASFDCDevQA 

Test Classes all show 0% now in Spring 13 sandbox

I have a trigger that I just deployed a month ago which had 100% code coverage under Winter 12.  Our Sandbox switched to Spring 13 and now it is showing 0% coverage.  I have rerun the tests and it varies from telling me 2/4 failed to 4/4 failed but always due to the sections where it is a system assert.  Nothing in the code changed except editing a little bit of the adderror line for the text it shows to the user.  Other classes/triggers seem to be having the same issues.  Is anyone else encountering this with Spring 13?

 

Thanks,

Amanda

Marc C.Marc C.

I'm having similar issues - code coverage has gone haywire in Spring13. Here's what works for me: put your tests in a single class file marked @IsTest with only testMethod methods inside.

 

Basically it seems that as of API version 27 (Spring 13), Code Coverage only works correctly if you separate your real code (normal classes or triggers) from your test code (@IsTest classes).

SFDCDevQASFDCDevQA
Yes. That is best practice and apparently is now being enforced. Test classes/testing code must be in a separate class from the actual triggers and classes. Quite frankly I don't even understand the need for the test classes since I always test my code to verify that it works anyway and if it does something unintentional it doesn't tell you that. It just tells you if it doesn't work. Seems like a complete waste of time to me but oh well. -- Amanda Howell Certified Salesforce.com Consultant 919-807-1116 amanda@sfdcsolutions.com