How to achieve Test Coverage for Interface Classes

I am using the trigger framework presented here, which uses several interfaces and utility classes:

And my question is the following: How does one achieve test coverage for Interfaces? Are these even factored in to test coverage?


The interface doesn’t need to be tested but any class that implements the interface will need test coverage

So ..

public interface IFoo {
   void doBar();

does not need to be test covered but the implementations do need coverage

public class MyClass implements IFoo {
  public void doBar() {
    // lines of code implementing doBar() method must be covered

The trigger framework you mentioned requires you to provide implementations of the various trigger handlers. When you do DML in your testmethods, the triggers will execute and the handlers will then get coverage

Source : Link , Question Author : atmdd , Answer Author : cropredy

Leave a Comment