Problem with testng running of a single class / method

Hello everyone. I am running into a weird issue with running testng. Any time that I try to run a TestNG class, by right-click > Run,  I get an error

Exception in thread "main" org.testng.TestNGException:
Test <test> element must define the name attribute
     at org.testng.xml.TestNGContentHandler.xmlTest(TestNGContentHandler.java:225)
     at org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.java:443)
     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
     at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:767)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1359)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
     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:807)
     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
     at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
     at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
     at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
     at org.testng.xml.Parser.parse(Parser.java:162)
     at org.testng.TestNG.setTestSuites(TestNG.java:507)
     at org.testng.TestNG.configure(TestNG.java:946)
     at org.testng.remote.RemoteTestNG.configure(RemoteTestNG.java:49)
     at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:77)

Process finished with exit code 1


Indeed, if I look at the ~/Library/Caches/IntelliJIdea90/temp-testng-customsuite.xml it's missing the name attribute on the test tag:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Custom suite" parallel="none">
  <test verbose="1" name="" annotations="JDK">
    <classes>
      <class name="xxx.xxx.xxx.xxx.ClassTest"/>
    </classes>
  </test>
</suite>



Any ideas ? I tried reinstalling Intellij, I deleted the caches folder, I restarted it, I deleted all the installed plugins.

Thank you,
  Andrei Dragomir
3 comments
Comment actions Permalink

Hello Andrei,

which versions of testng/IDEA do you use?

Thank you
-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

Hello everyone. I am running into a weird issue with running testng.
Any time that I try to run a TestNG class, by right-click > Run,  I
get an error

 org.testng.TestNGException:
> 
> Test  element must define the name attribute
> 
>      at
> org.testng.xml.TestNGContentHandler.xmlTest(TestNGContentHandler.java:
> 225)
> 
>      at
> org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.
> java:443)
> 
>      at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElem
> ent(AbstractSAXParser.java:501)
> 
>      at
> com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startEleme
> nt(XMLDTDValidator.java:767)
> 
>      at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl
> .scanStartElement(XMLDocumentFragmentScannerImpl.java:1359)
> 
>      at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl
> $FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)
> 
>      at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XM
> LDocumentScannerImpl.java:648)
> 
>      at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl
> .scanDocument(XMLDocumentFragmentScannerImpl.java:510)
> 
>      at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XM
> L11Configuration.java:807)
> 
>      at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XM
> L11Configuration.java:737)
> 
>      at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.j
> ava:107)
> 
>      at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Abs
> tractSAXParser.java:1205)
> 
>      at
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.pa
> rse(SAXParserImpl.java:522)
> 
>      at
> javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
> 
>      at
> javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
> 
>      at
> org.testng.xml.Parser.parse(Parser.java:162)
> 
>      at
> org.testng.TestNG.setTestSuites(TestNG.java:507)
> 
>      at
> org.testng.TestNG.configure(TestNG.java:946)
> 
>      at
> org.testng.remote.RemoteTestNG.configure(RemoteTestNG.java:49)
> 
>      at
> org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:77)
> 
> Process finished with exit code 1
> ]]>

Indeed, if I look at the
~/Library/Caches/IntelliJIdea90/temp-testng-customsuite.xml it's
missing the name attribute on the test tag:

 "http://testng.org/testng-1.0.dtd">
> 
> 
> 
> 
> 
> 
> ]]>

Any ideas ? I tried reinstalling Intellij, I deleted the caches
folder, I restarted it, I deleted all the installed plugins.

Thank you,
Andrei Dragomir
---
Original message URL:
http://www.jetbrains.net/devnet/message/5254420#5254420



0
Comment actions Permalink

Oh, it's Intellij 9.

Anyway, I fixed it, after a fashion. I searched more on the web, and I figured out that the test name is taken from the project name. For some reason, my project (maybe because it was imported from Eclipse projects) was defined by two files, but it didn't have a name; it was basically ".ipr", and ".iws". I simply renamed the ipr and iws file to actually have a name, and now it works.

So maybe the problem is that I had the project files without a name. I don't know exactly how this came to be, but maybe it's something one could look out for.

Thanks,
  Andrei Dragomir

0
Comment actions Permalink

I've faced with similar problem:

Connected to the target VM, address: 'javadebug', transport: 'shared memory'

java.io.FileNotFoundException: C:\Users\�������\.IntelliJIdea90\system\temp-testng-customsuite.xml (Системе не удается найти указанный путь)

 at java.io.FileInputStream.open(Native Method)

 at java.io.FileInputStream.<init>(FileInputStream.java:106)

 at org.testng.xml.Parser.<init>(Parser.java:68)

 at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:338)

 at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:91)

No test suite found.  Nothing to run

Disconnected from the target VM, address: 'javadebug', transport: 'shared memory'


But problem in this case was UTF8 encoding. Switching project to Windows-1251 (System default) fixes problem.
0

Please sign in to leave a comment.