51Testing软件测试论坛

标题: TestNg中提示找不到Cannot find class in classpath [打印本页]

作者: hjianhui    时间: 2016-1-11 11:51
标题: TestNg中提示找不到Cannot find class in classpath
selenium WebDriver中用TestNG xml文件启动,报错,有谁知道什么原因吗?
Cannot find class in classpath: test126Mail.src.com.test126Mail.testng
        at org.testng.xml.XmlClass.loadClass(XmlClass.java:81)
        at org.testng.xml.XmlClass.init(XmlClass.java:73)
        at org.testng.xml.XmlClass.<init>(XmlClass.java:59)
        at org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.java:548)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)

xml如下:

<?xml version="1.0" encoding="UTF-8"?>
<suite name="Suite1" verbose="1" >
  <test name="Regression1" >
    <classes>
      <class name="com.test126Mail.testng">
          <methods preserve-order="true">
              <include name="testLogin" />
          </methods>
      </class>
    </classes>
  </test>
</suite>



作者: joykao    时间: 2016-1-11 15:57
com.test126Mail.testng这个包名和类名没错吧?testng的插件和jar包都已经有了?强制刷新项目试试吧,或者选中testng.xml选择run as configuration,选择到项目然后重新选择下testng.xml文件运行




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2