You need to sign in to do that
Don't have an account?
Paddyb
Code Coverage for Deployment
I am trying to deploy from my Sandbox to Production. I 'Ran All Tests' and the code coverage is 75% but when I try to deply after running all tests - I get an error in production telling me that I dont have > 75% code coverage?
Any ideas?
Also I cant deploy a test class to increase the coverage - it gives me an error that the coverage is not high enough!
Run all tests in Production, and see what you get. The coverage might've dropped in Production for some reason. If all looks good in production, validate your deployment plan and you'll be able to see the classes that have low coverage.
Thanks.
Thats the problems, the code coderage is lower in production (72%). But I cant deploy test clases to increase this because of the low code coverage
So it is a perpetual ordeal... you're in for a long, long weekend, buddy!
Here's how I would've fixed this (perhaps you're already going through this painful procedure):
1) Run All Tests on production.
2) Pick classes whose coverage is way too low.
3) Write test code in Sandbox, and try to deploy.
4) Upon each failure, review which classes still lack coverage, and work on them.
While you write test code, make sure that you create data for your tests instead of relying on real data in the org. Since the data in sandbox and prod can be different, tests passing in sandbox may fail in prod.
Now, I have a VERY, VERY dirty work-around that comes in handy when you're fighting against time. Create fake classes that have no 'actual functionality', but just jack up coverage. For instance:
This will just give you the ability to be able to start working on the Production instance to increase test coverage. If you decide to go ahead w/ this, do make sure that you eventually write test code for all your 'real' classes, and delete this fake class.
Hope this helps.
Thanks.