java - 我必须在哪个目录中放置 testng.xml?

标签 java maven testng

我正在做一个项目,我必须在其中执行自动化测试。为此,我使用了 Testng 框架。

我将 testng.xml 作为输入文件,一些方法将使用它,但是现在我的阅读器方法无法检测到该文件。

我要在哪个目录中放置我的 testng.xml 文件......并且我必须在 pom.xml 中制定任何 Maven 规范来检测它testng.xml 文件在那里,他们必须阅读它。

最佳答案

In which directory I to place my testng.xml file.....

我怀疑 testng.xml 文件应该放在类路径的顶部。如果您正在使用 Maven,那么它的一个好地方是 src/test/resources/testng.xml。看这个例子:

How to call testng.xml file from pom.xml in Maven

is there any maven specification I have to make in pom.xml for detecting that testng.xml file is there and they have to read it.

我对此不是 100% 确定。在查看上面的示例时,它看起来像是推荐的以下内容:

<plugin>
    <groupId>org.apache.maven.plugin</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.12</version>
    <configuration>
       <suiteXmlFiles>
           <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
       </suiteXmlFiles>
    </configuration> 
</plugin>

关于java - 我必须在哪个目录中放置 testng.xml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12644035/

相关文章:

java - 触发浏览器PDF下载 Spring MVC

java - Netbeans/Eclipse 提取 GUI 代码

maven - 多个 SLF4J 绑定(bind) activemq-all-5.6.0.jar 出错

testng - 有没有一种方法可以显示属于某个TestNG组的所有测试?

java - 无法仅使用 dockerFile 运行测试文件 在执行套件之前和之后 未调用之前、之后和测试方法函数

java - HashMap共享对象问题

java - Jenkins Android 库 - 不支持的 Major.minor 版本 51.0

java - 使用 @ImportResource 导入 XML 配置不起作用

java - 运行 testng.xml 时出现 java.lang.NullPointerException 错误

java - JFreeChart拖拽绘图区