3

Is it necessary to add the test class of an apex class in changeset during migration from QA to PROD?

Suppose apex class is ABC_apexclass. Test class for the same is ABC_apexclass_TEST. Is it mandatory to add ABC_apexclass_TEST in changeset?

Thanks.

1

I don't believe it's mandatory to add the test class, however, if you want the code to be covered you will need to include it in Production.

  • Do you mean if I want to validate/deploy in PROD, I must have the test classes present in changeset? – MnZ Feb 19 '15 at 16:48
  • 1
    Yes, it doesn't run tests when deploying between sandboxes nor enforce code coverage. But in order for the class to have it's code covered in production the test class would need to be present. After every deployment it will run all tests to ensure overall coverage. That number (overall, not per class) can't be below 75%. salesforce.com/us/developer/docs/apexcode/Content/… – Brad Bumbalough Feb 19 '15 at 16:51
  • 1
    So you "technically" do not need it if the overall coverage is above 75% (including the new class) but it is obviously best practice to deploy it if you have it. – Brad Bumbalough Feb 19 '15 at 16:53
  • I have been deploying it for a long time, wasn't sure if it needed to be included. Thanks! – MnZ Feb 19 '15 at 16:58
1

Tests classes aren't necessary for change sets. However, you have achieve 75% overall code coverage and min. 1% code coverage for triggers (in prod).

It is important that you achieve 75% at any given time. Otherwise your deployment will fail.

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.