Skip to main content
removed error
Source Link
cropredy
  • 73.3k
  • 8
  • 128
  • 284

Does the code coverage failure have to do with the entire org or just the Change Set Components? If it is just the Change Set Components how to I get code coverage for my new Apex Class?

Every time you deploy to PROD, the deployment (including via Changesets) will rerun all of the testmethods in PROD - including everything new being deployed.

  1. Did you write a testmethod/testclass for your new class? If not, write it and include it in the changeset. You didn't include that in OP so that could be the easy fix.
  2. If you did write a testclass and it covers your code, then there must be something else in PROD that is not covering enough code in other classes. This then gets more involved to diagnose. Go to PROD and do a run all tests from the Developer Console. Inspect the code coverage. Consider using a fullcopy sandbox to mirror PROD where you can do more complete tests and get logs (logs in PROD on a run all tests are likely to be far greater in size than the 2MB limit

Does the code coverage failure have to do with the entire org or just the Change Set Components? If it is just the Change Set Components how to I get code coverage for my new Apex Class?

Every time you deploy to PROD, the deployment (including via Changesets) will rerun all of the testmethods in PROD - including everything new being deployed.

  1. Did you write a testmethod/testclass for your new class? If not, write it and include it in the changeset. You didn't include that in OP so that could be the easy fix.
  2. If you did write a testclass and it covers your code, then there must be something else in PROD that is not covering enough code in other classes. This then gets more involved to diagnose. Go to PROD and do a run all tests from the Developer Console. Inspect the code coverage. Consider using a fullcopy sandbox to mirror PROD where you can do more complete tests and get logs (logs in PROD on a run all tests are likely to be far greater in size than the 2MB limit

Does the code coverage failure have to do with the entire org or just the Change Set Components? If it is just the Change Set Components how to I get code coverage for my new Apex Class?

Every time you deploy to PROD, the deployment (including via Changesets) will rerun all of the testmethods in PROD - including everything new being deployed.

  1. Did you write a testmethod/testclass for your new class? If not, write it and include it in the changeset. You didn't include that in OP so that could be the easy fix.
  2. If you did write a testclass and it covers your code, then there must be something else in PROD that is not covering enough code in other classes. This then gets more involved to diagnose. Go to PROD and do a run all tests from the Developer Console. Inspect the code coverage. Consider using a fullcopy sandbox to mirror PROD where you can do more complete tests and get logs
Source Link
cropredy
  • 73.3k
  • 8
  • 128
  • 284

Does the code coverage failure have to do with the entire org or just the Change Set Components? If it is just the Change Set Components how to I get code coverage for my new Apex Class?

Every time you deploy to PROD, the deployment (including via Changesets) will rerun all of the testmethods in PROD - including everything new being deployed.

  1. Did you write a testmethod/testclass for your new class? If not, write it and include it in the changeset. You didn't include that in OP so that could be the easy fix.
  2. If you did write a testclass and it covers your code, then there must be something else in PROD that is not covering enough code in other classes. This then gets more involved to diagnose. Go to PROD and do a run all tests from the Developer Console. Inspect the code coverage. Consider using a fullcopy sandbox to mirror PROD where you can do more complete tests and get logs (logs in PROD on a run all tests are likely to be far greater in size than the 2MB limit