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 "http://testng.org/testng-1.0.dtd">
<suite name="Softpost Suite">
    <test name="softpostTests" preserve-order="true" >

        <packages>
            <package name="groupstests"/>
        </packages>

    </test>
</suite>

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 https://www.softpost.org/gradle/executing-testng-tests-in-gradle-project
 
test {
    useTestNG {
        suites 'src/test/resources/testng.xml'
    }
}

Web development and Automation testing

solutions delivered!!