function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Book_GuyBook_Guy 

Unit Test - Code Coverage

Hi All,

 

Does anyone know what would cause the code coverage on a unit test to drop?  So the trigger and test have not changed but the code coverage was 88% last month, now it is 65%.

 

--David

 

 

Ritesh AswaneyRitesh Aswaney
Sounds like the data then. Or possibly some config, such as a workflow field update.

If the test was selecting data rather than creating it's own data, then this co uld be a very likely cause.
NPNP

Did you update the code or add new code related to same object or dependent object.

Book_GuyBook_Guy

RR,

 

Can you give me some specific examples on what you mean by update or add code.  Are you referring to workflow rules, other triggers, validations rules, etc.... These types of additions nare made regularly and what I need to get a better handle on is how to makes these updates without having a negative impact on unit tests.

 

--David

NPNP

for eg;  on  opp. object you have a trigger  to update the default price book based on your record type ( US, UK, Canada).

your test class greate then 75% .

 

Today you added a trigger on account or contact related with  opp . Or you added 2 fields to update the bill to address using a trigger.

 

in this case your old test class will not meet then 75% mark.

 

some time there is a way if you think you test class had meet the 75% code coverage using the UI deployment tool or options.

 

Try using that and see .