簡體   English   中英

TestNG未在Eclipse上運行測試

[英]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();
        }

    }
  1. 檢查您的機器上是否存在用於TestNG Eclipse插件。
  2. 如果未安裝,請從Help => Eclipse Marketplace安裝最新版本。
  3. 重新開始蝕。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM