2

this is probably a simple question, but one that I've never been clear on. My client has a utility class with a lot of methods used for generating objects (users, accounts, etc.). Almost every method in the class is a utility method, except for one, which is a testMethod (old school way of combining testMethods in your classes). At the very top of the class they have @isTest.

@isTest
public class TestUtility{
    public static User getUser(){
    ....
    return user;
   }
etc. etc.
public static testMethod void myTest(){
...
}}

My colleagues and the client both think that by having @isTest at the top of the class, Salesforce will skip this class entirely and not count any of it towards code coverage. However, I still see it as mostly 'uncovered' when I run all tests. Can someone please tell me, who is correct? Thanks!

7

Code coverage does not include any classes which are annotated with @isTest. The UI will show them as uncovered, but they do not count towards your organization's 75% code coverage requirements.

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.