9

I have been working on a project using Android Studio since long. Today refactored some code and it started to break,so reverted the changes. Even after reverting the changes whenever I try to debug the code, I am ending up with following an exception :

org.testng.TestNGException: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 44; Attribute "parallel" with value "none" must have a value from the list "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; Attribute "parallel" with value "none" must have a value from the list "false methods tests classes instances ".
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
    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:396)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
    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:380)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:614)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3135)
    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:118)
    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: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:172)
    at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:305)
    ... 4 more

trying to open the project using intelliJ I can get this gone. Any clues on this??

Naman
  • 27,789
  • 26
  • 218
  • 353
  • Do you use a testng.xml? I suppose you are using testng 6.9.10 which check validity of the file. – juherr Dec 23 '15 at 11:03
  • updated to 6.9.10.. and yeah there is an xml for the test – Naman Dec 23 '15 at 11:05
  • Could you share it? But the problem is parallel param. Replace none by false. – juherr Dec 23 '15 at 11:06
  • I am not sure though, is this what you are looking for? ` ` @juherr – Naman Dec 23 '15 at 11:14
  • Ok, your file seems good. Do you have the problem when you run the suite via this file or when you run a test from IntelliJ itself (it generate a testng.xml itself in this case)? – juherr Dec 23 '15 at 11:41
  • I am trying to execute it using intelliJ. would try using the xml as well and update. – Naman Dec 23 '15 at 11:46
  • You can try to override the parallel attribute with false value. I think it is a IntelliJ issue. Maybe you can create an issue on https://youtrack.jetbrains.com/issues and then provide the ticket number here? It will allow me to follow it. – juherr Dec 23 '15 at 11:53
  • @juherr https://youtrack.jetbrains.com/issue/IDEA-149750 raised here..you can check. – Naman Dec 23 '15 at 12:17
  • Do you know yet what is setting `parallel` to `none`? To my knowledge, IntelliJ IDEA does not set this so it must be getting set somewhere else. How do you run your test? – mfulton26 Dec 23 '15 at 13:14
  • @mfulton26 I am running it using debug option from my class where the methods are annotated as Test – Naman Dec 23 '15 at 13:17
  • @nullpointer Have you changed the run configuration to pass in `parallel`? You might take a look there and if you don't see anything you could try deleting the run/debug configuration and then running again to create a fresh one. – mfulton26 Dec 23 '15 at 13:19
  • I would try doing that as well. Though i didn't change that anytime. – Naman Dec 23 '15 at 13:23
  • Actually, it looks like IntelliJ does set parallel after all. See http://stackoverflow.com/a/29659644/3255152. – mfulton26 Dec 23 '15 at 13:25
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/98830/discussion-between-mfulton26-and-nullpointer). – mfulton26 Dec 23 '15 at 15:32
  • @mfulton26 you got it! Your link says "IntelliJ actually creates an XML file and then uses that when running TestNG. That XML file has parallel="none" inside of it." what is not expected by the testng dtd – juherr Dec 23 '15 at 20:38
  • 1
    Please downgrade your TestNG version, for me it is working with 6.8.8 version. – sanjay singh Jul 03 '19 at 06:29

5 Answers5

3

Discussion and help from @juherr suggests that solution to this is :

Attribute "parallel" with value "none" must have a value from the list "false methods tests classes instances ".

TestNG 6.9.10 is now validating the xml file against the DTD The problem is that the default testng.xml template from IntelliJ is setting "parallel" on suite to "none". Here is the link to the bug for the same.

Naman
  • 27,789
  • 26
  • 218
  • 353
2

update the testng.xml to

<suite name="Suite" parallel="false">

from

<suite name="Suite" parallel="none">
Nabeel A.Rahman
  • 181
  • 3
  • 14
0

If you have no editable testng.xml file, you can downgrade your testng dependency to 6.9.9.

Matthias M
  • 12,906
  • 17
  • 87
  • 116
0

If you are using/implementing any listener in your class/project then add the annotation @Listeners on that class like below:

@Listeners(value=SuiteListener.class)

e.g.

@Listeners(value=ClassName who implemets listener.class)

e.g.

@Listeners(value=SuiteListener.class)
public class SuiteListener implements ISuiteListener
{
    lines of code / methods in class
}

Add below is a code snippet in testng.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
<listeners>
<listener class-name="report.SuiteListener"></listener>
</listeners>

  <test thread-count="5" name="Test">
    <classes>
      <class name="tests.Test1"/>
      <class name="tests.Test2"/>
    </classes>
  </test> <!-- Test -->

</suite> <!-- Suite -->
Pavel Smirnov
  • 4,611
  • 3
  • 18
  • 28
Avinash Pande
  • 1,510
  • 19
  • 17
-1

Faced same problem and same exception. Worked for me by removing

{parallel="none"}

or giving value

{parallel="false"}

in the testng.xml file. Afterward runs fine.

Naman
  • 27,789
  • 26
  • 218
  • 353