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.
Step1: Right-click on the Project folder, go to New and select 'File' as shown in the below image. Step 2: Add the file name as 'testng. xml' as shown in the below image and click on the Finish button. Step 3: Now you can add the below XML code in your testng.
TestNG. xml file is an XML file which contains all the Test configuration and this XML file can be used to run and organize our test. TestNG eclipse plugin can be used to automatically generate testng. xml file so no need to write from scratch.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With