1

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
  • 2
    What you describe is impossible. It's much more likely that you simply haven't included the test class in your deployment/changeset or you've misspelled a test class name (if you're using Run Specified Tests instead of Run Local Tests). As per usual, you'll need to edit your question to include more details.
    – Derek F
    Jun 21 at 13:44
  • @DerekF I guess its possible that only the test class could have been deleted via destructive deployment? I guess this is possible(Disclaimer: I've personally not tried this in a production org), although it would bring down the overall code coverage and pose problem to further deployments. I know it doesn't sound logical for someone to just delete test class alone this way, but rookie mistake could lead to this.
    – arut
    Jun 21 at 17:42

2 Answers 2

1

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

1
  • Thanks and that might be the reason .How the class got there. Jun 23 at 17:37
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.

1
  • Sure, thanks a lot for the reply. as u have advised i will create a test classes. Jun 23 at 17:35

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.