簡體   English   中英

執行 testNG.xml 文件時出錯

[英]Error while executing the testNG.xml file

在 Eclipse 中執行 Java testNG.xml文件時出現以下錯誤:

[TestNGContentHandler] [WARN] It is strongly recommended to add "<!DOCTYPE suite SYSTEM "
http://testng.org/testng-1.0.dtd" >" at the top of your file, otherwise TestNG may fail 
or not work as expected.

有人能幫忙嗎?

我已經將我的 testng-6.14.3 從 testng 7.xx 降級,現在它工作正常

在 testng.xml 文件中添加<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >這一行,它將是 testng.xml 文件的第二行。

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

我已將 POM.xml 中的 testNG 版本從 6.14.3 升級到

<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.1.0</version>
    <scope>test</scope>
</dependency>

更改版本解決了此錯誤。

此錯誤有 2 個可能的原因。

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >  is not present in your testng .xml
  1. 我最近遇到了您的 Java 版本與您的 testng 版本不兼容。

#2 更好地更新 testng 版本

它幫助我將 http 協議替換為 https,因此該行是

<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >

我的 Selenium 自動化也面臨同樣的問題。 我在 pom.xml 中為 TestNG 添加了二進制文件。 但我沒有任何 TestNG.xml 文件。 只是將類作為 TestNG 套件運行。

檢查您的 config.properties 是否有任何語法錯誤並更正它。 示例:任何屬性在行尾都有特殊字符(;或:等)。

暫無
暫無

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

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