解決 org.testng.TestNGException: Cannot find class in classpath

今天在使用 TestNG 時出現了下面的訊息,
org.testng.TestNGException: Cannot find class in classpath。
解決方法很簡單,在 Eclipse 上方的選單中,
選擇 Project -> Clean,接著等他重新 build 完就可以了。

圖片來源:http://www.pushtotest.com/pushtotest-for-developers.html

附上錯誤訊息:
org.testng.TestNGException:
Cannot find class in classpath: werdna1222coldcodes.blogspot.com.demo.xxx
 at org.testng.xml.XmlClass.loadClass(XmlClass.java:76)
 at org.testng.xml.XmlClass.init(XmlClass.java:68)
 at org.testng.xml.XmlClass.(XmlClass.java:54)
 at org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.java:500)
 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:276)
 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88)
 at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)

關鍵字:TestNG, TestNGException, Cannot find class in classpath
參考資料:

這個網誌中的熱門文章

繳納2018/107年度牌照稅信用卡回饋/分期整理!

證件遺失補辦身分證/健保卡/駕照/行照/信用卡總整理

2018最新博客來100,50,25折價券序號e-coupon分享

國泰Koko combo icash網購/超商/icash/繳費5%!

所得稅要繳多少?最新最完整的所得稅計算教學!再教你看懂稅率級距表/免稅額/扣除額!

Line Pay最新信用卡活動+店家30%+回饋整理!

街口支付最新信用卡+店家街口幣回饋整理!

地表最強HAPPY GO!限時轉點增值51.25%!

Openpoint快速集點活動+發揮2倍價值兌換攻略!

TOEIC多益成績分數查詢、計算標準與換算對照表