build.gradle file
def suite1 = project.hasProperty(“suite1”)
def suite2= project.hasProperty(“suite2”)
test {
useTestNG() {
// To generate reports by TestNG library
useDefaultListeners = true
if(project.hasProperty(‘suite1’)) {
suites ‘src/test/resources/testng-suites/smoke.xml’
}
if(project.hasProperty(‘suite2’)){
suites ‘src/test/resources/testng-suites/all.xml’
}
}
// turn off Gradle’s HTML report to avoid replacing the reports generated by TestNG library
reports.html.enabled = false
}
###################################
smoke.xml file
<test name="Test" preserve-order="true">
<classes>
<class name="com.tests.TestcaseFactory">
</classes>
</test>
###############################
when trying to run on cmd line with this command
>gradle test -Psuite1
BUILD SUCCESSFUL in 3s
8 actionable tasks: 1 executed, 7 up-to-date
#################
Basically i want to run my testng smoke.xml file as it works fine when i run it from eclipse. But its not showing me any thing when i run it from cmd line.
Thanks in advance.