TestNG options not working

I am trying to use TestNG and it would seem that suites options is not picked up correctly.

   task createTest(type: Test) {
    useTestNG() {
        suites 'src\test\resources\testng.xml'
        suiteName "APISuite"
        includeGroups 'Set'
        useDefaultListeners = true
    }
}

With a valid suite xml below I couldnt see my tests running.

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="APISuite">
    <packages>
        <package name="com.test.api.*" />
    </packages>
</suite>

And tried giving a wrong path to suites, but still no complaint. It seems there is no effect with options.suites method

Have now switched to maven as working with testng SuiteXMLs are an important requirement for me

I think you’re testng.xml is not valid. according to testng documentation you have to put the packages block within a test block:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="APISuite">
    <test name="all">
    <packages>
        <package name="com.test.api.*" />
    </packages>
    </test>
</suite>