0

I'm trying to deploy a class to production, and after doing some reading I set up the proper ant things and decided to deploy the sample classes to the sandbox first. I get the following errors:

Code Coverage Failures: 1. Class: CalculateBusinessHoursAges -- Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required 2. Average test coverage across all Apex Classes and Triggers is 11%, at least 75% test coverage is required. *********** DEPLOYMENT FAILED ***********

They have been using Saleforce for 10 years at least, so there are 100s of classes and triggers, many of which were automatically created by integrations, etc and have no tests/are hidden so I couldn't add them if I tried... Does anyone know a way around this? I just want to deploy one class!

  • are you also deploying the test class that goes with CalculateBusinessHoursAges ? – cropredy Jan 6 '15 at 20:22
  • No I'm deploying the sample classes from SalesForce. There is a test for the CalculateBusinessHoursAges trigger and that seems to be broken, so I'm taking a look at that – Emma Jan 6 '15 at 20:42
0

When deploying to production, Salesforce requires overall test coverage to be at least 75%. If they have code in production, they must have tests for it, or it wouldn't be in production.

However, you stated that you are trying to deploy to a sandbox. You are not required to have coverage to deploy to a sandbox, so you must be specifying that tests should be run in your ant file (build.xml). Look for your deploy target, and look for either runAllTests or runTests. Try removing these, or cloning the deploy target and removing them from the clone.

The Salesforce Migration Guide covers the ant tool; the section 'Deploying Changes to a Salesforce Organization' covers the build.xml options for deploying.

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.