【问题标题】:Unable to run testng file using run as Testng Test无法使用 run as Testng Test 运行 testng 文件
【发布时间】:2017-08-15 18:26:44
【问题描述】:

我在 src/test 文件夹中有带有 testng 文件的 maven 项目。当我运行 Maven 安装命令时,我看到所有 testng 都在运行。但是,当我尝试单独运行一个 testng 文件时,它的运行方式为 --> Testng Test。我遇到了异常。

org.testng.TestNGException:在类路径中找不到类:HelloClass

我能够使用 maven 构建选项生成 testng 类文件并保存在 target/test-classes 文件夹下。

【问题讨论】:

  • 你能补充更多细节吗?也许是您正在做什么的屏幕截图,您的套件 xml 文件是什么样的等等,
  • 您似乎没有创建一个包,您正在使用默认包运行 testNG。我强烈建议您创建一个包并开始使用 testNG 执行该程序。它肯定会奏效。

标签: testng


【解决方案1】:

尝试将所有测试类从 src/test/java 移动到 src/main/java

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多