In which directory should I place testng.xml?

I am doing one project in which I have to do automation testing. For this, I use the Testng platform.

I am providing testng.xml as an input file, and some method will use it, however right now my reading method cannot detect the file.

In which directory do I place the testng.xml file ..... and is there any maven specification that I have to do in pom.xml to detect that the testng.xml file is there and they should read it.

+4
source share
2 answers

In which directory do I put my testng.xml file .....

I suspect that the testng.xml file should be placed at the top of your class path. If you are using maven, then src/test/resources/testng.xml would be a good place for it. See this example:

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

is there any maven specification that I have to do in pom.xml to detect that the testng.xml file is there and they should read it.

I am not 100% sure. When looking at the above example, it looks something like this:

 <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> 
+5
source

It doesn't matter where you put as long as you specify the path in your maven pom.xml under maven-surefire-plugin

0
source

Source: https://habr.com/ru/post/1436854/


All Articles