2

I have in my prodn org test coverage of over 82%. I ran the Test-> runall test from developer console.

I want to move in a few fields and 2 classes and 1 test class into prodn. These 2 classes have coverage of 88% and 100%.

But when i moved the code thru change sets and deploy them. They give an error that my code coverage is 72%.

Is there any reason why the coverage is low when i deploy the changeset?

  • 1
    When you try to deploy, are you getting any other test errors or exceptions? – Jeremy Nottingham Jun 29 '13 at 6:56
  • The only error i get is that coverage is 72% – Prady Jun 29 '13 at 8:35
  • Have you tried the fast deploy feature? – Sergej Utko Jun 29 '13 at 8:38
  • @mast0r - No, how do we do that? – Prady Jun 29 '13 at 8:50
  • 1
    Echoing @Daniel, such Prod changes could include a) other APEX deployments done from other sandboxes; b) Workflow changes not copied to your sandbox; c) Validation rule changes not copied to your sandbox. Another possibility is that you have multiple triggers on the same SObject and because SFDC doesn't guarantee order dependency amongst triggers, your sandbox triggers might execute in one order but when deployed to PROD, they execute in a different order - if your code implicitly relies on execution order ...you could get your issue. – cropredy Jul 1 '13 at 18:19
4

Before Deploying Code to production, please clear the existing code coverage from the production's Apex class setup page and then run all tests to see the new coverage. The changes that have been done after the previous deployment might've reduced your code coverage, like a class/trigger gone invalid/inactive because of change at object level. Once you calculated your new apex coverage,try deploying your new components.It would be better if you first deploy the fields and then deploy the classes.

| 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.