I have a test class that is basically covering a class which has structure like

  public class classA {
    public class classB implements Triggers.Handler {
       public void handle(){
         ---some code----

I have a trigger on object, something like

 trigger someTrigger on someObject(before insert, before update) {

new Triggers()

    .bind(Triggers.Evt.beforeInsert, new classA.classB())        


I am inserting someObject in the test class and I also see its going into the ClassB in debug logs, but the code coverage for classA is showing as 0%. I have no idea what the issue is. Any thoughts or help??


There is a known issue http://success.salesforce.com/issues_view?id=a1p30000000Rle5AAC that was apparently fixed in Summer '12 but looks like there was a regression.

I ran into this problem before and was able to workaround it by creating an instance of the Outer class in the test.

private class TestClassA {
  static {
    // This should get code coverage on inner class
    new ClassA();

  @isTest static void testSomethingInClassB() {
    ClassA.ClassB b = new ClassA.ClassB();
| improve this answer | |
  • Awesome. Thanks for the direction and solution. I am now able to get the coverage for the class – logontokartik Jan 28 '13 at 11:46

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.