My teammates have deployed a code to production without getting the class getting covered. and now I have added a small functionality and trying to push the code but deployment is failing is class handler are covering 0%. I'm wondering how did other teammates move the code to production without getting it covered
2 Answers
While deploying, you can choose Run Local Tests
, that will run all tests in the organization and count 75% of code coverage for all code in organization and not for specific classes / triggers.
https://help.salesforce.com/s/articleView?id=000335222&type=1
What I've discovered is that when a production ORG is in "Trial" mode, you can actually build classes directly in the ORG just like a dev environment. Once provisioned then you have to spin up sandboxes for any custom development work. That could be how those classes got there to begin with with no test coverage.
You will probably have to write the test classes now as part of your current task in order to push your new code.
-
Sure, thanks a lot for the reply. as u have advised i will create a test classes. Jun 23 at 17:35
Run Specified Tests
instead ofRun Local Tests
). As per usual, you'll need to edit your question to include more details.