'Gradle TestNG how to run all suites without hardcoding them in build.gradle
I am working on a Java TestNG project with gradle We have multiple xml test suites In order to run them we pass them as this :
suites ("src/test/resources/sanity.xml",
"src/test/resources/buyside.xml",
"src/test/resources/useraccess.xml",
"src/test/resources/outboundfiles.xml",
"src/test/resources/quicksight.xml")
But everytime I add a new suite to the project I have to add it manually in the build.gradle file Is there a way to get all the suites in the project?
I searched the documentation for gradle-testng and found a method getSuiteXmlFiles() but i dont know how to use it. If I pass it like
suites (getSuiteXmlFiles())
It does not work.
Is this the correct method to use and how can I use it ? Or if there is another way to fetch all the suites in the project please let me know
Thank you
Solution 1:[1]
I found a solution to do it I defined a list of all xml files in the folder resources
def allSuites = new File("src/test/resources/").listFiles();
Then I passed it to the suites method:
suites allSuites
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | user3661644 |
