function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Itai KatheinItai Kathein 

Code Coverage: 0% Your overall code coverage is currently 0%. To deploy code to production, you must have at least 75%.

Code Coverage: 0%Your overall code coverage is currently 0%. To deploy code to production, you must have at least 75%.

I get this when trying to push my first changeset from sandbox to production.

Tried applying different solutions suggested by this forum like compiling all classes and running the tests from the begining yet nothing seems to change.

Please advise.
 
bob_buzzardbob_buzzard
Do you have any test classes in your production org?  Do you see any errors when you validate the change set?
YuchenYuchen
Are you including the Test Classes in the changeset? Also, when you clear the test history and run all tests in your Sandbox, what is the percentage that you are getting?
Itai KatheinItai Kathein
Hey thank you for replying.

Bob, I have some classes in my production but they are all coming from 3rd party application, this is my first attempt to code anything.

Yuchen, I didn't deploy any test classes for this changeset, it's just 1 class, in my sandbox envoirment I get the same problem, 0% always.

Your thoughts?

 
YuchenYuchen
Since you are deploying 1 class, you may want to make sure you have some test coverage for the class. You can create the Test Class for that class in your Sandbox, then in the changeset, deploy the class and test class together to production.

Some links to Test Class in Salesforce:
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_qs_test.htm
https://developer.salesforce.com/page/An_Introduction_to_Apex_Code_Test_Methods