【问题标题】:How maven pom.xml identifies the testng test cases in a non-standard project structure?maven pom.xml 如何识别非标准项目结构中的 testng 测试用例?
【发布时间】:2014-12-13 22:07:49
【问题描述】:

我对 maven 和 testng 完全陌生。我使用 maven 作为构建工具,并使用 testng 作为我的测试框架。我没有遵循标准的 Maven 项目结构。现在我希望我的pom.xml 执行我项目中的测试用例。问题是,pom.xml 如何知道要考虑执行哪些测试用例?

【问题讨论】:

  • 你的问题没问题,因为你的写作质量,你被否决了。如果你想在这样的论坛上取得成功,你需要尽快解决这个问题。
  • @Peter Horvath 感谢您的宝贵建议。最初我想知道为什么我的声誉得分会降低。也感谢您的澄清。以后,我希望我的写作质量会很好。
  • 不遵循maven默认文件夹布局的原因是什么?
  • @khmarbaise 没有特殊原因。这是项目要求
  • 很抱歉。但是这种不遵循这些约定的愚蠢行为会导致配置比您通常需要的更多,从而导致花钱。

标签: java maven automated-tests testng pom.xml


【解决方案1】:

如果你把它放在一个地方,你需要设置 maven-surefire-plugin 配置的 testClassesDirectory 参数:

<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.17</version>
        <configuration>
          <testClassesDirectory>path/to/compiled test classes</testClassesDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
  [...]
</project>

所有这些都在Maven Surefire Plugin Documentation中有详细记录

【讨论】:

  • 非常感谢您的及时帮助
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-02-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-12-12
相关资源
最近更新 更多