Cannot run TestNG suite

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot run TestNG suite

jonderry
I am currently unable to run a TestNG suite on Fedora 14 and Eclipse
3.6.1. Previously, there was an option in the right click menu to run
or debug either as a test or a suite, but now only the test option is
available. The only other way I know of to run tests is via the emacs+
plugin (alt+x run-testng-suite) or via "run configurations...", and
running via these methods results in an exception similar to what was
discussed in:

http://groups.google.com/group/testng-users/browse_thread/thread/d5284548de972000#

I have tried three versions of the plugin spread over a couple of
months and tried running the test suite via two different workspaces
(one untouched for a couple of weeks, and was working the last time I
was in it), and the error is the same in each case (no option to run/
debug as test suite, and the following exception if I attempt to run
via any other means). What could the problem be?


org.testng.TestNGException: org.xml.sax.SAXParseException; lineNumber:
1; columnNumber: 1; Content is not allowed in prolog.
        at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:24)
        at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:10)
        at org.testng.xml.Parser.parse(Parser.java:153)
        at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:280)
        at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:90)
        at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205)
        at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber:
1; Content is not allowed in prolog.
        at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:
198)
        at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:
177)
        at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:
391)
        at
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:
1391)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl
$PrologDriver.next(XMLDocumentScannerImpl.java:1014)
        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:
625)
        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
488)
        at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:
812)
        at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:
741)
        at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:
123)
        at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:
1208)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
$JAXPSAXParser.parse(SAXParserImpl.java:525)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:392)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
        at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:17)
        ... 6 more

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

Reply | Threaded
Open this post in threaded view
|

Re: Cannot run TestNG suite

Cédric Beust ♔-2
Hi Jon,

On Wed, Mar 2, 2011 at 12:26 PM, jonderry <[hidden email]> wrote:
I am currently unable to run a TestNG suite on Fedora 14 and Eclipse
3.6.1. Previously, there was an option in the right click menu to run
or debug either as a test or a suite, but now only the test option is
available.

The Suite menu item was a bug, it should only be available when you right click on a testng.xml file.

The error seems to indicate a problem in your XML file, can you post it? It looks like there might be an invalid character on the first line (it might be a space).

-- 
Cédric

 
The only other way I know of to run tests is via the emacs+
plugin (alt+x run-testng-suite) or via "run configurations...", and
running via these methods results in an exception similar to what was
discussed in:

http://groups.google.com/group/testng-users/browse_thread/thread/d5284548de972000#

I have tried three versions of the plugin spread over a couple of
months and tried running the test suite via two different workspaces
(one untouched for a couple of weeks, and was working the last time I
was in it), and the error is the same in each case (no option to run/
debug as test suite, and the following exception if I attempt to run
via any other means). What could the problem be?


org.testng.TestNGException: org.xml.sax.SAXParseException; lineNumber:
1; columnNumber: 1; Content is not allowed in prolog.
       at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:24)
       at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:10)
       at org.testng.xml.Parser.parse(Parser.java:153)
       at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:280)
       at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:90)
       at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205)
       at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber:
1; Content is not allowed in prolog.
       at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:
198)
       at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:
177)
       at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:
391)
       at
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:
1391)
       at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl
$PrologDriver.next(XMLDocumentScannerImpl.java:1014)
       at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:
625)
       at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
488)
       at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:
812)
       at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:
741)
       at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:
123)
       at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:
1208)
       at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
$JAXPSAXParser.parse(SAXParserImpl.java:525)
       at javax.xml.parsers.SAXParser.parse(SAXParser.java:392)
       at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
       at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:17)
       ... 6 more

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.




--
Cédric


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Cannot run TestNG suite

jonderry
In reply to this post by jonderry
OK, it's working now. IDK what changed or if I'm misremembering the
ui, but I can run the entire class as a testng test and it seems to
work.

On Mar 2, 12:26 pm, jonderry <[hidden email]> wrote:

> I am currently unable to run a TestNG suite on Fedora 14 and Eclipse
> 3.6.1. Previously, there was an option in the right click menu to run
> or debug either as a test or a suite, but now only the test option is
> available. The only other way I know of to run tests is via the emacs+
> plugin (alt+x run-testng-suite) or via "run configurations...", and
> running via these methods results in an exception similar to what was
> discussed in:
>
> http://groups.google.com/group/testng-users/browse_thread/thread/d528...
>
> I have tried three versions of the plugin spread over a couple of
> months and tried running the test suite via two different workspaces
> (one untouched for a couple of weeks, and was working the last time I
> was in it), and the error is the same in each case (no option to run/
> debug as test suite, and the following exception if I attempt to run
> via any other means). What could the problem be?
>
> org.testng.TestNGException: org.xml.sax.SAXParseException; lineNumber:
> 1; columnNumber: 1; Content is not allowed in prolog.
>         at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:24)
>         at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:10)
>         at org.testng.xml.Parser.parse(Parser.java:153)
>         at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:280)
>         at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:90)
>         at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205)
>         at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)
> Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber:
> 1; Content is not allowed in prolog.
>         at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseE xception(ErrorHandlerWrapper.java:
> 198)
>         at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Erro rHandlerWrapper.java:
> 177)
>         at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErr orReporter.java:
> 391)
>         at
> com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScan ner.java:
> 1391)
>         at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl
> $PrologDriver.next(XMLDocumentScannerImpl.java:1014)
>         at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocu mentScannerImpl.java:
> 625)
>         at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scan Document(XMLDocumentFragmentScannerImpl.java:
> 488)
>         at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Co nfiguration.java:
> 812)
>         at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Co nfiguration.java:
> 741)
>         at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:
> 123)
>         at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Abstract SAXParser.java:
> 1208)
>         at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
> $JAXPSAXParser.parse(SAXParserImpl.java:525)
>         at javax.xml.parsers.SAXParser.parse(SAXParser.java:392)
>         at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
>         at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:17)
>         ... 6 more

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

Reply | Threaded
Open this post in threaded view
|

Re: Cannot run TestNG suite

darpan shah
I had the same issue. It looks to me, there is some whitespace issue in .xml file. So I did these: (Using eclipse)
1. Tried to find .xml that testng is using as my test class is not using any .xml file. (Later found out, its not even reaching to the code). Deleted .xmls generated by testng in AppData. Didnt work.
2. Copied the same code and created new dummy class, pasted here. It worked. That means the first file has somewhere associated .xml that I need to change it.
3. In eclipse, I converted my class to TestNG test class. (If you right click on your class, you should see option under TestNG IF you have installed TESTNG plugin in your eclipse). Thus, it created testng.xml file and started working.
This is a workaround but it worked. 

On Wednesday, March 2, 2011 at 3:43:01 PM UTC-5, jonderry wrote:
OK, it's working now. IDK what changed or if I'm misremembering the
ui, but I can run the entire class as a testng test and it seems to
work.

On Mar 2, 12:26 pm, jonderry <[hidden email]> wrote:

> I am currently unable to run a TestNG suite on Fedora 14 and Eclipse
> 3.6.1. Previously, there was an option in the right click menu to run
> or debug either as a test or a suite, but now only the test option is
> available. The only other way I know of to run tests is via the emacs+
> plugin (alt+x run-testng-suite) or via "run configurations...", and
> running via these methods results in an exception similar to what was
> discussed in:
>
> <a href="http://groups.google.com/group/testng-users/browse_thread/thread/d528." target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://groups.google.com/group/testng-users/browse_thread/thread/d528.&#39;;return true;" onclick="this.href=&#39;http://groups.google.com/group/testng-users/browse_thread/thread/d528.&#39;;return true;">http://groups.google.com/group/testng-users/browse_thread/thread/d528...
>
> I have tried three versions of the plugin spread over a couple of
> months and tried running the test suite via two different workspaces
> (one untouched for a couple of weeks, and was working the last time I
> was in it), and the error is the same in each case (no option to run/
> debug as test suite, and the following exception if I attempt to run
> via any other means). What could the problem be?
>
> org.testng.TestNGException: org.xml.sax.SAXParseException; lineNumber:
> 1; columnNumber: 1; Content is not allowed in prolog.
>         at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:24)
>         at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:10)
>         at org.testng.xml.Parser.parse(Parser.java:153)
>         at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:280)
>         at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:90)
>         at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205)
>         at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)
> Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber:
> 1; Content is not allowed in prolog.
>         at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseE xception(ErrorHandlerWrapper.java:
> 198)
>         at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Erro rHandlerWrapper.java:
> 177)
>         at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErr orReporter.java:
> 391)
>         at
> com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScan ner.java:
> 1391)
>         at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl
> $PrologDriver.next(XMLDocumentScannerImpl.java:1014)
>         at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocu mentScannerImpl.java:
> 625)
>         at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scan Document(XMLDocumentFragmentScannerImpl.java:
> 488)
>         at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Co nfiguration.java:
> 812)
>         at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Co nfiguration.java:
> 741)
>         at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:
> 123)
>         at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Abstract SAXParser.java:
> 1208)
>         at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
> $JAXPSAXParser.parse(SAXParserImpl.java:525)
>         at javax.xml.parsers.SAXParser.parse(SAXParser.java:392)
>         at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
>         at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:17)
>         ... 6 more

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.