Error while executing custom testng.xml

(randomuser) #1

So I have been racking my brains for hours now to get this working but no luck so far.

What I am trying to do: To kick of my testng xml suite using gradle build file.

Approach 1:
I added following details in the task test, as specified in gradle dosumentation:

test {
useTestNG {
suites ‘src/test/resources/masterSuite.xml’

and kicked off gradle build file as Gradle test, I get following error:

Approach 2: I googled and came across this this post on stacktrace where ther user had created a custom test task:

I tried using it and gradle complained about not being able to recognize org.testng.TestNg. Stacktrace:

MyGradle build file:

Gradle version: 2.12
Java Version: 8
IDE: Eclipse

What am I doing wrong? Please help.