For some reason, two (out of ten) of my test classes are showing up in the Class Code Coverage section when I run all Apex tests. They also have a Code Coverage percentage on my Apex class list.
The classes all start with
Looking at coverage, I see that Salesforce is marking lines from a subclass of the test class, used as a helper object by the various test methods. It's also flagging lines in static methods used by the test methods.
From this answer to a related question, I had assumed everything inside of my
@isTest class would not be included in code coverage metrics.
You can also include non-test utility methods in classes marked as @isTest and (this is the compelling part) they do not need to be covered by tests themselves, and can only be called from inside of test methods! Very useful for data generation methods that are not needed in production code.
More information (and possible cause found): We have Test Classes that use static methods from the Test Classes getting listed with Code Coverage. That would indicate to me that we should potentially have a special "TestHelper" class to hold these methods instead, and that the "TestHelper" class will need to be tested itself.