How to specify testng method order with Gradle?

I’m doing some high-level exploration of TestNG, as opposed to JUnit, for acceptance testing.

One thing that might be needed for acceptance tests is to control test method execution order. I understand how to control this with TestNG from the command line, or from Maven or Ant, but it’s not clear to me how this translates to the Gradle interface. TestNG uses an XML file to define the test methods to use, and whether to execute them in order. It appears that the Gradle interface to TestNG attempts to subsume the functionality of the XML file into the Gradle build script. I looked in the section of the doc that describes this, but I didn’t see any mention of how to list the methods to execute, and to preserve that order.

You can specify ‘suiteXmlFiles’ or use ‘suiteXmlBuilder’ when configuring ‘TestNGOptions’ using ‘Test.useTestNG()’ to pass/specify the xml for a TestNG suite.