I am using Gradle with TestNG. I have this build.gradle:
useTestNG() { useDefaultListeners = true suites \"src/test/resources/tests1.xml\"
In build.gradle update:
test { useTestNG() { if (project.hasProperty('suite1')) { suites './src/test/suite1.xml' } if (project.hasProperty('suite2')) { suites './src/test/suite2.xml' } } }
Use command gradlew test -Psuite1 to run suite1 and similarly update for suite2 as well.
gradlew test -Psuite1