I am writing integration tests with TestNG and facing this trivial issue.
No runnable methods
java.lang.Exception: No runnable methods
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
Test class is like this (After Stephen's suggestion, I removed 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);
}
}
This error usually occurs when we don't have @Test
annotation or if we don't have @Runner
. Do we need some other set-up for TestNG
?