1

I just ran into everyone's favourite deployment error message:

Average test coverage across all Apex Classes and Triggers is 74%, at least 75% test coverage is required.

When investigating test coverage of various Apex classes, I noticed that some have a coverage value of NaN% as shown below:

01p8E000002HmFgQAK  MyVeryImportantService           93%      26   
01p8E000002RyphQAC  OpportunityStageNames            NaN%    

The Apex class OpportunityStageNames just contains public static final String properties:

public class OpportunityStageNames {
    public static final String Qualification = 'Qualification';
    ...
    public static final String ClosedLost = 'Closed\Lost';
    public static final String ClosedWon = 'Closed\Won';
}

To avoid having any magic strings in the code base.

My question is, does Apex class test coverage of NaN% effect my overall org test coverage in a negative way?

4

No, it does not.

Apex test coverage is calculated as the percentage of lines covered out of total executable lines.

The class OpportunityStageNames contains no executable lines of code, so it cannot be covered, and its lines do not contribute to the denominator of the fraction (lines covered)/(total executable lines) across any defined subset of your Apex code or the total corpus.

1
  • 2
    Note: this is a bug with the DX CLI. I've reported this so it can be fixed at some point. Regardless, this answer is perfectly correct. – sfdcfox Jun 1 '20 at 21:48

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.