I pushed a changeset from stage (sandbox) to production. Everything worked fine in stage but in production it didnt. It just says "Test Coverage of Selected Apex Trigger is 0%, at least 1% test coverage is required".

Both the production and stage code are same. I know its data, but to dig into the details, I would like to view the detailed debug log which was executed during changeset validation.

Even If I give run test for the test class in production it says that trigger has 0% code coverage after running the test class. (The test class passed though).

I enabled the debug log for my user id and viewed the logs after that particular test class executed in production. It said Maximum debug log size reached. FYI, I have even set debug log filters

Can some one help me here to debug and find where the issue is?

2 Answers 2



If a trigger is not firing, then the insert/update/delete of the SObject is failing before the trigger is being invoked. For example, an after insert/update trigger will not fire if there are validation rule errors during the insert/update. Or, if the before insert/update triggers execute an add.error to prevent the DML from committing.

Given that it works in stage but not PROD, you need to verify that Stage mirrors PROD in terms of validation rules and workflow field updates.


Another thing to check is that if the stage testmethod uses @isTest(SeeAllData=true) it is highly likely to have different behavior in PROD than in Stage where the dataset size will be different.

Debug logs

As for debug log levels, start off by just running with Validation and Database logging and turn off Apex code and System logging to see why Possibility #1 (the DML operation is not committing) thus preventing the trigger from executing.

If you need to see Apex code logs and you're exceeding max debug log, see this post for suggestions https://salesforce.stackexchange.com/a/11251/2602

UPDATE - revised answer to take advantage of latest SFDC features

This feature actually exists but in an indirect way.

For the failing test class(es):

  • Use Validate on the Changeset deployment
  • Turn debugging on for you in the Developer Console
  • Select in the Deployment options - Run Specified Tests - name your test class
  • Validate ​

All logs for that test class by method will appear in the DC Log panel.


Have you downloaded the log to see what kind of data is being captured before the maximum log size is reached? I strongly suspect the problem is related to work rules firing that are also being captured in the log causing it to fill up prematurely. The only way to determine that is to look at what's being captured, then reduce your logging levels.

I'd recommend you set your logging at the lowest level of detail, to see if you can get through, then increase it incrementally.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .