1 package test.tmp; 2 3 import org.testng.annotations.Factory; 4 import org.testng.annotations.Test; 5 6 public class TestCaseFactory { 7 class MyTestClass { 8 @Test testAll()9 public void testAll() { 10 } 11 } 12 13 @Factory createTestCases()14 public Object[] createTestCases() { 15 Object[] testCases = new Object[1]; 16 testCases[0] = new MyTestClass() { 17 }; 18 return testCases; 19 } 20 }