使用Selenium和Testng无法找到TestNG的dtd文件

时间:2015-07-27 21:29:26

标签: selenium testng

我的xml如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testing-1.0.dtd">
<suite name="Suite" parallel="tests">
//  <test name="FirefoxTest>
//      <parameter name="browsers" value="firefox"/>
//      <classes>
//<class name="com.ibm.spng.LoginExample"/>
//      </classes>
//  </test>
    <test name="ChromeTest>
        <parameter name="browser" value="chrome"/>
        <classes>
<class name="com.ibm.spng.LoginExample"/>
        </classes>
    </test>
    <test name="IETest>
        <parameter name="browser" value="ie"/>
        <classes>
<class name="com.ibm.spng.LoginExample"/>
        </classes>
    </test>
</suite>

但是我得到了FileNotFundException

org.testng.TestNGException: java.io.FileNotFoundException: http://testng.org/testing-1.0.dtd
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:341)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: java.io.FileNotFoundException: http://testng.org/testing-1.0.dtd
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1637)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.testng.xml.XMLParser.parse(XMLParser.java:39)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:17)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:10)
at org.testng.xml.Parser.parse(Parser.java:168)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:311)
... 3 more

我无法点击http://testng.org/testing-1.0.dtd

如何解决这些错误?

1 个答案:

答案 0 :(得分:0)

拼写错误。它没有测试。将其更改为

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