遇到TestNG不能正常执行@Test,加@Factory解决了,简记如下: 123456789101112 public class { public (String s){ // ... } public void test(){ // ... }} 上面的@Test方法是无法执行的,加@Factory即可解决: 1234567891011121314151617181920 public class { public (String s){ // ... } @Factory public static Object[] create() throws IOException{ List<TestA> result = new ArrayList<TestA>(); TestA te = new TestTest("hi"); result.add(te); return result.toArray(); } public void test(){ // ... }} 这个例子抽象得不够好,有时间再总结一下@Factory。 赞微海报分享
近期评论