I mean if in order to test some method I will write another method (not marked as @IsTest) then it will decrease test coverage?

So, in this example:

  @isTest private static void deleteDuplicatesTest() {
  private boolean areDuplicates() {
     if (boolean1) {}
     if (boolean2) {}
     if (boolean3) {}

method areDuplicates() will decrease test coverage? (if not all boolean statements will be used?)

  • Is this in a production class or part of the test class (one marked @IsTest itself)? If it is in a production class with tests mixed into it then this would count as part of coverage (the test methods would not), whereas if it is a test class it has no bearing on test coverage.
    – Phil W
    Jun 17, 2020 at 7:36

1 Answer 1


The bottom line these days1 is that if you have a class with the @isTest annotation, everything contained in that class is considered "test code", and does not contribute to your overall test coverage (nor to the 3 million character limit for custom apex code).

Before you get any funny ideas, no, you can't use this to get around test requirements. Test code can only be invoked by Salesforce as part of a test context.

1: A few years back, we were able to have @isTest annotated methods inside of a 'normal' (i.e. non-test-annotated) class. Those test methods did not count towards coverage. We can't do that any more. @isTest annotated methods must be part of an @isTest annotated class, so it became meaningless to think of individual methods not counting towards coverage.

You must log in to answer this question.

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