cbeust/testng — Issue #111: @BeforeClass method not executed if in parent class
Author: ash2k
Created: 2011-10-17 15:42:13+00:00
State: open

```java
package com.test.test;

import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public abstract class AbstractTest {

@BeforeClass
public void beforeClass() {
System.err.println("beforeClass");
}

@BeforeMethod
public void beforeMethod() {
System.err.println("beforeMethod");
}

@Test
public void testAbstract() {
System.err.println("Abstract TEST");
}

@AfterMethod
public void afterMethod() {
System.err.println("afterMethod");
}

@AfterClass
public void afterClass() {
System.err.println("afterClass");
}
}
```

```java
package com.test.test;

import org.testng.annotations.Test;

public class Test1 extends AbstractTest {
@Test
public void test() {
System.err.println("TEST");
}
}
```

Actual output:

beforeClass
beforeMethod
Abstract TEST
afterMethod
afterClass
beforeMethod
TEST
afterMethod
afterClass

Expected output:

beforeClass
beforeMethod
Abstract TEST
afterMethod
afterClass
beforeClass
beforeMethod
TEST
afterMethod
afterClass

Can be reproduced with TestNG 6.2 and 6.3.