2

I am moving my classes from Sandbox to Production. All the classes have a minimum coverage of 80% in my sandbox. The change set contains both my Apex class and the test class. But in my production, I'm getting an error Your code coverage is 0%. You need at least 75% coverage to complete this deployment.

I also don't have any unexpected required fields or validations in my production. Where am I going wrong?

2
  • 1
    Is this the only error you have? Apr 21, 2016 at 7:47
  • 1
    It's maybe a really dumb proposition, but check you putted the tests list comma separated. This happens to me sometimes if i'm not really focused. Apr 25, 2016 at 11:53

5 Answers 5

3

I used Specified Tests Option while deploying.

we need to make sure that Test classes are separated by commas

TestclassA, TestClassB, TestClassC

If they are not separated by comas, it may result above error.

1
  • 1
    Correct! Some people put all the test classes in a separate line ( under Run Specified Tests) which also causes the same error! Apr 29, 2020 at 10:43
2

I think you should check all dependency, static resource and also check the field you are using in apex class exist in production or not

3
  • I am not using any static resource. But yeah, all the fields and the dependencies exist
    – User2529
    Apr 21, 2016 at 7:03
  • please make sure about all dependency, when we have some dependency its always show 0% coverage Apr 21, 2016 at 7:05
  • Yogesh, all the dependencies were in place. I've posted what the issue was. Thanks anyway :)
    – User2529
    Apr 27, 2016 at 5:32
2

Okay, here was the mistake I was doing. I used Run Specified Tests to validate my classes and I was adding only the test classes that were needed to move my apex classes to production. But the customer had introduced some validations directly into his production environment and hadn't updated his existing test classes. This made the existing test classes obsolete and they were throwing an error.

I found this when I deployed the change set with Default as my option to validate the test classes and here all the test classes were executed and the error was thrown.

1

Simply run all tests when deploying. It happened to me as well. I guess it's a Salesforce bug/feature.

1
  • Yup, instead of running all tests, I'd given the option as Default. I didn't mark this as the answer as I wanted everyone else to know the mistake I was doing. Anyway, thanks :)
    – User2529
    Apr 27, 2016 at 5:33
0

In my case, the problem was that I simply haven't removed test classes file extensions from the RunSpecifiedTests files list.

So for example, instead of TestClassOne, TestClassTwo, TestClassThree I had TestClassOne.cls, TestClassTwo.cls, TestClassThree.cls. The files have to be listed comma separated and the without file extension.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .