When TestNG of selenium + java runs, the following error is reported:
org.testng.TestNGException:
Cannot find class in classpath: NewTest
at org.testng.xml.XmlClass.loadClass(XmlClass.java:81)
at org.testng.xml.XmlClass.init(XmlClass.java:73)
at org.testng.xml.XmlClass.<init>(XmlClass.java:59)
at org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.java:543)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
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:172)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:311)
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)
Found a lot of information on the Internet, changed the XML file, but still can’t
original XML file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="none">
<test name="Test">
</test> <!-- Test -->
</suite> <!-- Suite -->
Modified xml files
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="true">
<test name="Test">
<classes>
<class name="com.frame.ng.Newtest"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
Later, I saw a friend in Zhihu saying that the source folder path had been wrongly written when the testngclass was newly built. So changed the path, everything cleared up after rain
Similar Posts:
- [Solved] XML Read Error: Invalid byte 1 of 1-byte UTF-8 sequence
- [Solved] Caused by: org.xml.sax.SAXParseException: Premature end of file.
- [Solved] java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.internal.ws.api.BindingID
- [Solved]Caused by: org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 134; Document root element “beans&quo…
- [Flowable6.4.1] [DMN] cvc-elt. 1: Declaration of element ‘definitions’ not found
- Python: How to Read file initialization from file failed by panda
- [Solved] Spark Install Error: ERROR SparkContext: Error initializing SparkContext. java.lang.reflect.InvocationTargetException
- Sqlite Error:com.intellij.execution.ExecutionException: Exception in thread “main” java….
- Error in compiling APR util for Linux
- Solution of JMeter pressure test “Java. Net. Socketexception: socket closed”