我遇到了selenium和testNG的问题,这是我的代码:
public class NewTestNGTest {
@BeforeClass
public void setUp() {
WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.com");
}
@Test
public void aTest() {
System.out.println("Test");
}
@AfterClass
public void cleanUp() {
// code that will be invoked after this test ends
}
}
,错误日志显示:
测试用例:initializationError(NewTestNGTest):导致错误发生 没有可运行的方法
java.lang.Exception:java.lang.reflect.Constructor.newInstance(Constructor.java:526)中没有runnable方法
对我有什么建议吗?
谢谢
答案 0 :(得分:0)
请检查您的eclipse项目中是否正确引用了TestNG库。
默认情况下,eclipse附带了与它捆绑在一起的JUnit。但是你必须自己从eclipse市场安装TestNG。
@Test与JUnit和TestNG使用的注释相同。
修改强>
在NetBeans IDE中运行TestNG测试:
1)http://wiki.netbeans.org/TestNG
2)how to work in selenium with testNG in Netbeans IDE?