Hi,
I am new to gradle and I am stuck at running my testsuite in gradle. Below are my files:
Build.gradle file:
task createTest(type: Test) {
test {
useTestNG() {
suites 'src/test/resources/testNG.xml'
useDefaultListeners = true
}
}
}
and my testNG file is:
<?xml version="1.0" encoding="UTF-8"?><listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter" />
<listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
<listener class-name="support.ReportingTools" />
</listeners>
<parameter name="browser" value="FF" />
<parameter name="timeout" value="45" />
<parameter name="driverLocation"
value="src/test/resources/ChromeDriverServerx32/chromedriver.exe"></parameter>
<parameter name="excelSheetLocation"
value="/src/test/resources/DataSheets/LiveScoreValidationTest.xls" />
<parameter name="sheetName" value="dataProvider" />
<parameter name="suppressScreenshot" value="true" />
<test name="LiveScoreTest" enabled="true" verbose="5">
<parameter name="excelSheetLocation"
value="/src/test/resources/DataSheets/LiveScoreValidationTest.xls" />
<parameter name="sheetName" value="dataProvider" />
<classes>
<class name="Scripts.LiveScoreValidationTest" />
</classes>
</test>
<test name="HeadlessBrowserTesting" enabled="false" verbose="5">
<parameter name="browser" value="PHANTOM" />
<parameter name="driverLocation"
value="src/test/resources/PhantomJSServer/bin/phantomjs.exe"></parameter>
<classes>
<class name="Scripts.HeadlessBrowserTesting1" />
</classes>
</test>
</suite>
Everytime I run the task it says Build Successful but does not run my test cases.
Note : I dont want to use directly this solution-
task runTests(type: JavaExec, dependsOn: ‘classes’) {
main = 'org.testng.TestNG'
classpath = files("./src/test/resources",
project.sourceSets.main.compileClasspath,
project.sourceSets.test.compileClasspath,
project.sourceSets.main.runtimeClasspath,
project.sourceSets.test.runtimeClasspath)
args = ["-parallel", "methods", "-threadcount", "1", "-d", "./build/test-output", "./src/test/resources/TestNGFiles/testNG.xml"]
}
}
as using this I am not able to disable the default test listener. Appreciate your quick response.