I am trying to deploy a change set which includes to classes and a test class. For validation I am only running two test classes, one which is included in the set and one which is already in production.

This scenario fails with Fatal Error and 0% coverage for all classes. If I run the same validation with only one test class running then I don't get the fatal error but the coverage is not enough

Can someone help, why the first scenario with the two test classes is not working?

  • can you include error verbitage in this question. – Santanu Boral Dec 3 '17 at 0:29
  • Have you tested various combinations of some/all unit tests in the sandbox, and what are results then? Is there a reason you're not writing enough test coverage in your two classes? – David Cheng Dec 3 '17 at 5:01

Try to validate your apex class against the related test class. Make sure that test class has 75% or above code coverage.This should allow you to deploy your code into production. I am not sure why do you want to validate it against a test class which is already in production.

  • 1
    because the test class already in production covers the code I am deploying – Dedo Dec 3 '17 at 6:27
  • In that case, check if the test class in production still covers the 75% test coverage(in your sandbox), if yes try to validate and deploy the test class again to production. If the test class deployment is successful then validate and deploy the actual set you've been wanting to deploy. – user31302 Dec 3 '17 at 18:23

I wasn't able to find why this use case was behaving like it did.

Eventually I copied the test methods from the test class that was already in production to the test class I was deploying with the code and then deployment passed.

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.