[英]TestNG not running test on eclipse
Any idea why TestNG is not running my test? 知道为什么TestNG没有运行我的测试吗? this is the class code(java):
这是类代码(java):
public class main {
@Test
public static void main(String[] args) throws AWTException, InterruptedException
this is the path on eclipse: enter image description here 这是蚀的路径: 在此处输入图像描述
and this is the XML file: 这是XML文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test name="Test">
<classes>
<class name="test.main"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
I am Posted here a demo template for Your testng.You just need to take a class and declear webdriver. 我已在此处发布了testng的演示模板。您只需要上一堂课并清除webdriver。
@BeforeMethod
will execute before start any @Test
then @AfterMethod
Hope it will help you. @BeforeMethod
将在启动任何@Test
之前执行,然后@AfterMethod
希望对您有所帮助。
package stackoverflow;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.*;
public class DemoTestNGClass {
public static WebDriver driver;
@BeforeMethod
public void setUp1() throws Exception {
driver= new ChromeDriver();
}
@Test
public void Homepage() throws InterruptedException {
//Your operation
}
@Test
public void ListingPage() throws InterruptedException {
//Your operation
}
@AfterMethod
public void afterresult(){
driver.close();
}
}
TestNG
is present on your machine. TestNG
Eclipse插件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.