Reputation: 536
I'm doing one project in which I have to perform automation testing. For this purpose I'm using Testng framework.
I am giving testng.xml
as input file and some method will consume it, however right now my reader method is not able to detect the file.
In which directory I to place my testng.xml
file..... and 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.
Upvotes: 9
Views: 15935
Reputation: 430
It does not matter where you put as long as you specify the path in your maven pom.xml under maven-surefire-plugin
Upvotes: 0
Reputation: 116828
In which directory I to place my testng.xml file.....
I suspect that the testng.xml
file should be put at the top of your classpath. If you are using maven then a good place for it would be src/test/resources/testng.xml
. See this example:
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.
I'm not 100% sure about this. In looking at the above example it looks like something like the following is recommended:
<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>
Upvotes: 6