We have a test class, and it has @isTest and for some reason, salesforce is showing this class as needing coverage? Shouldn't this class be excluded from code coverage?

global class MyMockResponse implements HttpCalloutMock{
    global HTTPResponse respond(HTTPRequest request) {
         //some code

2 Answers 2


It doesn't need coverage if it is annotated with @IsTest. Any report to the contrary is in error. Note however that you shouldn't be using global.


This seems like a bug in salesforce... The following post had the resolution. Why are my Test Classes (marked @isTest) getting listed with Code Coverage?

 1. Copy the listed test class and paste into notepad.
 2. Delete the listed test class.
 3. Create new test class with **same class name** and **same body**(structure).
 4. Finally Run the test class.

You must log in to answer this question.

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