[SalesForce] Deployment Issue

I validating my components in Production it throws an Deploy Error:

Deployment Error:"Average test coverage across all Apex Classes and
Triggers is 'X'%,at least 75% test coverage is required".The trigger
intended to be deployed does not have any code coverage issue as its
code coverage is more than 75% in the sandbox.

I Run All Apex Text Classes in Sandbox some classes are less then 75% code coverage then I modified the Test Classes then I try to deploy the Test Classes then also .But it throws same deploy error.

Best Regards,
Ramesh


Thank you for responding.First two points are fine,But
3. My folks are Deployed some Triggers with out test Classes also.
4. Yes,One of apex test Class using hoard coded some UserId,
How to resolve this issue?

Best Regards,
Ramesh

Best Answer

This is showing because the average code coverage is < 75% in the production org, and you need to work out why. Things to check are:

  1. Is code coverage in production over 75% before deploying? If not something is broken there that will need to be fixed first.

  2. Does production have any workflows or field validation rules that could be breaking your tests

  3. Are you definitely deploying your tests along with the trigger

  4. Does your trigger (or its tests) use any hard coded IDs, or rely on any data that's in the org? The test method should generate it's own data to work with, and IDs for record types etc. will be different between the orgs.

Related Topic