Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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??

share|improve this question
up vote 4 down vote accepted

There is a known issue 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();
share|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 posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.