gradle integration in testng

In this topic, let us see how to run the TestNG XML suite file in Gradle project. You will have to create below XML test suite file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "">
<suite name="Softpost Suite">
    <test name="softpostTests" preserve-order="true" >

            <package name="groupstests"/>


You will have to use below lines in build.gradle to use TestNG XML suite file. Notice that you will have to provide entire path starting from src directory. After this, you can run test task from Gradle. It will execute the tests as specified in XML file. You can find more information on TestNG and Gradle at
test {
    useTestNG {
        suites 'src/test/resources/testng.xml'

Complex problems, Simple Solutions