Why can I not deploy to a sandbox without test coverage?

I have a directory of apex classes, checked into version control, that I need to be able to programatically delete and then re-deploy into a Salesforce Sandbox. I do not want to deploy to production, I just need a quick way to delete all of these files.

So I tried to use the force.com deploy tool to deploy the sample code to my SANDBOX, and it won’t let me because of code coverage. Why is this? Is the deploy tool trying to ALSO deploy to production? Why would it do that? Is the deploy tool not meant to be able to deploy local files to a sandbox environment?

EDIT: I have verified that my login credentials are valid by executing ant describeMetadata successfully. Also, my serverurl is set to https://test.salesforce.com

EDIT 2: I commented out the following line from the deployCode target in the sample build.xml

And the deploy worked! Why though? Why would that for some reason affect whether code coverage matters for the rest of the classes in the sandbox?


If the tests are run they are not only run – but also their results will be taken into account. That means a rollback on failure. Not meeting the test coverage counts as failure and you get your rollback.

Not running the tests as you set it up now brings you another advantage: you could save a lot of time, since tests may slow down the deployment significantly.

But if you want the tests for some reason to be run I would recommend to do it separately after deployment in the background. Either manually or automated but decoupled from this process.

Source : Link , Question Author : atmdd , Answer Author : Uwe Heim

Leave a Comment