[英]TestNG not running test on eclipse
知道為什么TestNG沒有運行我的測試嗎? 這是類代碼(java):
public class main {
@Test
public static void main(String[] args) throws AWTException, InterruptedException
這是蝕的路徑: 在此處輸入圖像描述
這是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 -->
我已在此處發布了testng的演示模板。您只需要上一堂課並清除webdriver。 @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
Eclipse插件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.