本文介绍了突然不能从蚂蚁TestNG的运行测试([TestNG的]致:抛出java.lang.ClassNotFoundException:com.beust.jcommander.ParameterException)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用蚂蚁和TestNG 6.1.1,和我昨天就好了我的测试工作。今天,当我尝试运行我得到包括COM /博伊斯特/ jcommander / ParamException的NoClassDefFoundError测试。下面是输出:

I am using ant and TestNG 6.1.1, and I had my tests working just fine yesterday. Today when I try to run the tests I get a NoClassDefFoundError involving com/beust/jcommander/ParamException. Here is the output:

[copy] Copying 1 file to /Users/djohnson/src/webapp/components/build/tmp
[testng] Exception in thread "main" java.lang.NoClassDefFoundError: com/beust/jcommander/ParameterException
[testng] Caused by: java.lang.ClassNotFoundException: com.beust.jcommander.ParameterException
[testng]    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[testng]    at java.security.AccessController.doPrivileged(Native Method)
[testng]    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[testng]    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[testng]    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[testng]    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[testng] The tests failed.

下面是我使用的.xml文件:

Here is the .xml file I'm using:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Single Method Suite">
  <test name="Single Method Test">
    <classes>
      <class name="DhcpTest">
        <methods>
          <exclude name=".*" />
          <include name="setGetEnabledTest" />
        </methods>
      </class>
    </classes>
  </test>
</suite>

我也指定没有运气类的完整路径。我检查类路径中,一切似乎很好,没有人对此有什么想法?

I've also specified the complete path for the class with no luck. I've checked the classpath and everything seems fine, does anyone have any ideas on this?

推荐答案

如果你使用的蚂蚁,JC​​ommander应该是里面testng.jar,所以我想你testng.jar文件可能已损坏。

If you're using ant, JCommander should be inside testng.jar, so I'm thinking your testng.jar file might be corrupt.

这篇关于突然不能从蚂蚁TestNG的运行测试([TestNG的]致:抛出java.lang.ClassNotFoundException:com.beust.jcommander.ParameterException)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 05:02