【问题标题】:Unable to run TestNG due to java.lang.NoClassDefFoundError: org/testng/CommandLineArgs由于 java.lang.NoClassDefFoundError 无法运行 TestNG:org/testng/CommandLineArgs
【发布时间】:2019-10-09 21:46:05
【问题描述】:

在 Intellj 中设置 TestNG 后,我尝试通过 testng.xml 文件运行测试用例。但是我在线程“main”java.lang.NoClassDefFoundError: org/testng/CommandLineArgs- 错误中收到了一个-Exception

其他解决方案都没有帮助我。谢谢

我已经尝试过编辑 Testng 的配置,将套件更改为“在整个项目中”和“在单个模块中”选项,但它们都不起作用。

TC 已经拥有@Test() 值以便运行它们。

TESTNG.XML 文件配置

    <classes>

        <class name="testCases.TC_1688"/>
        <class name="testCases.TC_1689"/>

    </classes>


</test>

我收到以下错误

线程“main”中的异常 java.lang.NoClassDefFoundError: org/testng/CommandLineArgs 在 org.testng.RemoteTestNGStarter.main (RemoteTestNGStarter.java:120)

【问题讨论】:

  • 请说明您使用的是哪个 IDEA 版本?在没有 IDEA(即使用 Gradle 测试)的情况下运行测试时,您是否会收到类似的错误?重现的示例项目将非常有帮助。另请查看 YouTrack 以获取解决方案:youtrack.jetbrains.com/issues/…
  • IDEA 2019.1,我没有尝试运行 gradle 测试。至于信息,我只是想运行一个登录:Testcases: import java.util.concurrent.TimeUnit;导入 org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver;// 导入包pageObject.* import appModules.SignIn_Action;导入 org.testng.annotations.Test;导入实用程序。常量; @Test() public class TC_1688 { private static WebDriver driver = null; ……并尝试使用问题描述中的信息来运行它
  • 运行 testng 套件的示例项目对我来说是正确的。请在提供示例项目和配置的 YouTrack 上创建问题。谢谢

标签: java selenium intellij-idea automated-tests testng


【解决方案1】:

问题已解决

从项目结构中的库中删除旧的 testng-5.11-jdk15。ù

问题与以下帖子有关: - https://youtrack.jetbrains.com/issue/IDEA-143967

【讨论】:

    猜你喜欢
    • 2019-02-01
    • 2021-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多