1package test.factory.classconf; 2 3import org.testng.annotations.AfterClass; 4import org.testng.annotations.BeforeClass; 5import org.testng.annotations.Factory; 6import org.testng.annotations.Test; 7 8 9/** 10 * This class/interface 11 */ 12public class XClassOrderWithFactory { 13 public static final String EXPECTED_LOG= "BTABTABTA"; 14 public static final StringBuffer LOG= new StringBuffer(); 15 16 @Factory 17 public Object[] createInstances() throws Exception { 18 return new Object[] { 19 new XClassOrderTest(), new XClassOrderTest(), new XClassOrderTest() 20 }; 21 } 22 23 public static class XClassOrderTest { 24 @BeforeClass 25 public void beforeClass() { 26 LOG.append("B"); 27 } 28 29 public @Test void test() { 30 LOG.append("T"); 31 } 32 33 public @AfterClass void afterClass() { 34 LOG.append("A"); 35 } 36 } 37} 38