解決 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最新博客來100,50,25折價券序號e-coupon分享

【符碼刷卡報】超商消費繳費懶人包+優惠總整理

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

【符碼刷卡報】行動支付繳費/消費最高享5%回饋!水費/電費/停車費/etag/醫院費用…

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

2018/107年繳汽機車燃料費信用卡優惠整理!

玉山銀行Pi拍錢包信用卡,國內外2.5%指定通路最高4.5%P幣回饋!(~2019/08/31)

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