Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TestNG test cases are not compiling when i do project -> clean

I am using Spring, TestNG, Eclipse, Maven, Mac OS

Scenario is

I am doing some changes in my test cases ( TestNG test cases ),

Then i do Project -> Clean in eclipse

Now i am running the test file, but the changes not updated.

I suspects that the test files are not compiled.

I can run the server and i can run my webservices

But if i run maven test ( mvn test ), the entire code is compiling including test cases.

So to run the test cases i am running mvn test command only.

Not able to run through eclipse.

Eclipse config:

Auto build on

In Java build path the test package is included

If you need any more info i'll provide.

org.testng.TestNGException: 
    Cannot find class in classpath: com.***.***.model.***.case.CaseModelImplTest
        at org.testng.xml.XmlClass.loadClass(XmlClass.java:76)
        at org.testng.xml.XmlClass.init(XmlClass.java:68)
        at org.testng.xml.XmlClass.<init>(XmlClass.java:54)
        at org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.java:512)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
        at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:788)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
        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:511)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
        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:119)
        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.SuiteXmlParser.parse(SuiteXmlParser.java:17)
        at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:10)
        at org.testng.xml.Parser.parse(Parser.java:170)
        at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:304)
        at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:86)
        at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:199)
        at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:170)
like image 689
Jon Avatar asked Sep 13 '11 09:09

Jon


People also ask

Why does TestNG ignore test?

Sometimes, it happens that our code is not ready and the test case written to test that method/code fails. In such cases, annotation @Test(enabled = false) helps to disable this test case. If a test method is annotated with @Test(enabled = false), then the test case that is not ready to test is bypassed.

How do I enable test cases in TestNG?

TestNG @Test enable parameter. You can disable or exclude the test cases by using the enable attribute to the @Test annotation and assign False value to the enable attribute.

How do you resolve TestNG no tests found nothing was run?

Solution. The easiest solution would be to change the @BeforeTest annotation with @Test and execute you Test case / Test Suite.


Video Answer


2 Answers

It seems , you are not included your Test case class into the build path. Right click on your Project folder, go to the project properties->src
include your Testcase src folder by checking it.
Now it should run.

like image 177
Karthikeyan Avatar answered Nov 15 '22 06:11

Karthikeyan


Open the Problems view. In Eclipse go to Window->Show View->Problems. It will list out all the failures while compiling the code.

like image 23
Jlearner Avatar answered Nov 15 '22 06:11

Jlearner