我正在做一个项目,我必须在其中执行自动化测试。为此,我使用了 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/