我正在用 TestNG 编写集成测试并面临这个微不足道的问题。
No runnable methods
java.lang.Exception: No runnable methods
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
测试类是这样的(根据斯蒂芬的建议,我删除了 SpringJunitRunner):
@Test
@ContextConfiguration(locations = { "file:spring-configuration/mobiusdatabase-integration-testing.xml" })
public class PersistUrlTests extends AbstractTestNGSpringContextTests {
@Autowired
protected MobiusDatabaseServiceClient mobiusDatabaseServiceClient;
@Autowired
UrlDAO urlDAO;
@Autowired
ScraperUrlDAO scraperUrlDAO;
@BeforeClass
public static void init() throws Exception {
}
@Test
public void checkTest() {
GetActiveCategoriesResponse response = mobiusDatabaseServiceClient.newGetActiveCategoriesCall().call();
System.out.println(response.getCategoryList());
Assert.assertTrue(true);
}
}
当我们没有@Test
注释或没有注释时,通常会发生此错误@Runner
。我们需要其他一些设置TestNG
吗?