If I try to run a Selenium test class (or single test) via right-click -> Run as -> testNG or using a run configuration, I get:
[RemoteTestNG] detected TestNG version 6.10.0
org.testng.TestNGException: java.net.ConnectException: Connection refused: connect
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:325)
at org.testng.remote.AbstractRemoteTestNG.initialize(AbstractRemoteTestNG.java:137)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:98)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:647)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1304)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1270)
at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:264)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1161)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1045)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:959)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
at org.testng.xml.XMLParser.parse(XMLParser.java:39)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:16)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:9)
at org.testng.xml.Parser.parse(Parser.java:170)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:305)
... 4 more
This works for suite XML files, though. I.e. using "Run as > TestNG" on a TestNG XML file starts running the selenium tests indicated in the file, just as expected.
I debugged the failing test execution and saw that, at some point, the code checks whether or not the DTD's URL is http://testng.org/dtd (note the "http"), in which case the DTD is not fetched from internet. Because this is the last version of the plugin, the DTD of the "magically created" XML suite uses https, therefore it does not match the http URL, so the logic tries to download the DTD file and fails.
The machine is running behind a corporate proxy, which I think may be the cause for the error, but the proxy settings in Eclipse are correct and I can download plugins, update, etc, without issues.
Any relate message in "Error Log" view
"Windows -> Show View -> Others -> Error Log"
No further errors appear in the error log.
The Dependency Management tool for your project
[ ] Maven
[x] Gradle
[ ] Ant
[?] Eclipse Buildpath (aka. Use "TestNG Library" for your project in Eclipse)
Buildpath is installed, but the project is imported as a "Gradle Project"
Operating System
[x] Windows
[ ] Linux
[ ] OSX
What follows is, I think, a separate bug, and I'd be happy to file it separately if required
, which is basically the same XML generated by the plugin, but changing the DTD's URL to http instead of https. This causes an error:
An internal error occurred during: "Launching ManageOccupationQualifiersOnServiceAgreement".
org.testng.TestNGException:
TestNG by default disables loading DTD from unsecured Urls. If you need to explicitly load the DTD from a http url, please do so by using the JVM argument [-Dtestng.dtd.http=true]
Adding -Dtestng.dtd.http=true to the JVM arguments in "Window > Preferences > TestNG > Run/Debug" has no effect, i.e. I think the plugin is not properly adding the JVM arguments when running a TestNG test.
Problem Statement
If I try to run a Selenium test class (or single test) via right-click -> Run as -> testNG or using a run configuration, I get:
This works for suite XML files, though. I.e. using "Run as > TestNG" on a TestNG XML file starts running the selenium tests indicated in the file, just as expected.
I debugged the failing test execution and saw that, at some point, the code checks whether or not the DTD's URL is http://testng.org/dtd (note the "http"), in which case the DTD is not fetched from internet. Because this is the last version of the plugin, the DTD of the "magically created" XML suite uses https, therefore it does not match the http URL, so the logic tries to download the DTD file and fails.
The machine is running behind a corporate proxy, which I think may be the cause for the error, but the proxy settings in Eclipse are correct and I can download plugins, update, etc, without issues.
Any relate message in "Error Log" view
No further errors appear in the error log.
The Dependency Management tool for your project
Operating System
What follows is, I think, a separate bug, and I'd be happy to file it separately if required
I tried to "force" using http://testng.org/dtd by providing an XML template:
, which is basically the same XML generated by the plugin, but changing the DTD's URL to http instead of https. This causes an error:
Adding
-Dtestng.dtd.http=true
to the JVM arguments in "Window > Preferences > TestNG > Run/Debug" has no effect, i.e. I think the plugin is not properly adding the JVM arguments when running a TestNG test.