apply plugin: 'java'
repositories { mavenCentral() }
dependencies { testCompile 'org.testng:testng:5.13.1' }
def listener = new TestListenerImpl()

test {
    useTestNG()
    addTestListener(listener)
    ignoreFailures = true
}

class TestListenerImpl implements TestListener {
    void beforeSuite(TestDescriptor suite) { println "START [$suite] [$suite.name]" }

    void afterSuite(TestDescriptor suite, TestResult result) { println "FINISH [$suite] [$suite.name]" }

    void beforeTest(TestDescriptor test) { println "START [$test] [$test.name]" }

    void afterTest(TestDescriptor test, TestResult result) { println "FINISH [$test] [$test.name] [$result.exception]" }
}
