解決 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
參考資料:


相關文章

這個網誌中的熱門文章

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

【博客來折價券】最新100,50,25序號e-coupon免費分享(持續更新)

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

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

銀行代碼查詢:3碼銀行代碼列表、7碼分行代碼查詢

【國泰KOKO COMBO icash】2018網購/超商/icash/繳費5%神卡!

2018最新iPhone XS, XS Max, XR信用卡刷卡回饋/分期攻略!(持續更新)

【台新@GoGo】一般消費1.5%網購3.5%!行動支付/保費同享優惠密技!

【華南新戶5%】限時申辦華南指定icash聯名卡獨享2019年全年網購5%!(2018/12/15前申辦)