title: TestNG @AfterMethod bind to methods of current class
body: <p>Well, I'm a bit confused.</p>
  
  <pre><code>public class GroupDemo {
  
     @Test()
     public void test1() {
          System.out.println("test1");
     }
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>public class GroupDemoChild extends GroupDemo{
  
     @Test
     public void atest(){
         System.out.println("atest");
     }
  
     @AfterMethod
     public void after() {
         System.out.println("after method");
     }
  }
  </code></pre>
  
  <p>And what is logical to expect here:</p>
  
  <pre><code>test1
  atest
  after method
  </code></pre>
  
  <p>However I get:</p>
  
  <pre><code>test1
  after method
  atest
  after method
  </code></pre>
  
  <p>So <code>after()</code> is invoked twice.</p>
  
  <p>How do I run it only after methods of declaring class?</p>
  
  <p>TestNG = 6.8.5;
  Java = 1.7</p>