title: alwaysRun parameter in TestNG
body: <p>Can someone please explain me when <code>@AfterMethod(alwaysRun = true)</code> should execute. Will it execute when <code>@test</code> method is skipped. In documentation is written so, but I have observed different behavior.</p>
  
  <p>Example:
  Code:</p>
  
  <pre><code>public class testing{
  
      @Test
      public void testCase2(){
          System.out.println("in test case 2");
          Assert.assertEquals(1,2);
      }
  
      @Test(dependsOnMethods = { "testCase2" })
      public void testcase3(){
          System.out.println("OK");
      }
  
      @AfterMethod(alwaysRun = true)
      public void afterMethod2() {
          System.out.println("in afterMethod");
      }
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>in test case 2
  in afterMethod
  FAILED: testCase2
  java.lang.AssertionError: expected [2] but found [1]
     at org.testng.Assert.fail(Assert.java:94)
     at org.testng.Assert.failNotEquals(Assert.java:494)
     at org.testng.Assert.assertEquals(Assert.java:123)
     at org.testng.Assert.assertEquals(Assert.java:370)
     at org.testng.Assert.assertEquals(Assert.java:380)
     at app.testing.testCase2(testing.java:22)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:606)
     at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
     at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
     at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
     at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
     at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
     at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
     at org.testng.TestRunner.privateRun(TestRunner.java:767)
     at org.testng.TestRunner.run(TestRunner.java:617)
     at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
     at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
     at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
     at org.testng.SuiteRunner.run(SuiteRunner.java:240)
     at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
     at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
     at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
     at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
     at org.testng.TestNG.run(TestNG.java:1057)
     at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
     at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
     at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
  
  SKIPPED: testcase3
  
  ===============================================
  Default test
  Tests run: 2, Failures: 1, Skips: 1
  ===============================================
  
  
  ===============================================
  Default suite
  Total tests run: 2, Failures: 1, Skips: 1
  ===============================================
  </code></pre>
  
  <p>Shouldn't <code>@After</code> method be executed twice, also after skipped <code>@Test</code>?
  Thanks for answer in advance :)</p>