Caused by: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 44; 值为 "none" 的属性 "parallel"

前端之家收集整理的这篇文章主要介绍了Caused by: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 44; 值为 "none" 的属性 "parallel"前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Caused by: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 44; 值为 "none" 的属性 "parallel" 必须具有列表 "false methods tests classes instances " 中的值。

idea用testNg与spring做测试的时候报错,如下所示:

org.testng.TestNGException: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 44; 值为 "none" 的属性 "parallel" 必须具有列表 "false methods tests classes instances " 中的值。
    at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:325)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:90)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:206)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:177)
    at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:125)
Caused by: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 44; 值为 "none" 的属性 "parallel" 必须具有列表 "false methods tests classes instances " 中的值。
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.validateDTDattribute(XMLDTDValidator.java:1392)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(XMLDTDValidator.java:1311)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1917)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:742)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:379)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:605)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3138)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:880)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
    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:648)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:332)
    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:172)
    at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:305)
    ... 4 more

原因为6.9.10版本的testng,开始验证xml中的元素;而idea默认的testng.xml模板中parallel设置为none,因此报错。

所以解决方法

1. testng 使用6.9.9

或者

2. testng使用6.9.10, 在testng.xml中parallel设置为false

原文链接:https://www.f2er.com/xml/294798.html

猜你在找的XML相关文章