Question

I have a functional test module that uses TestNG and has a gradle build script that works just fine in gradle 1.6, I was trying to bump up my gradle version to 1.11 and this module started throwing the following error.

Could not find property 'projectDir' on   org.gradle.api.tasks.testing.testng.TestNGOptions_Decorated@47537eb5.

The error is on the following gradle task

task adminTest(type: Test) {
  useTestNG() {
    systemProperties['browser'] = 'firefox'
    systemProperties['dbUrl'] = connectionString
    systemProperties['baseurl'] = "$baseurl"

    suites 'src/test/java/org/open/functional/testng-admin.xml'
  }
   options {
      listeners << 'org.uncommons.reportng.HTMLReporter'
      listeners << 'org.uncommons.reportng.JUnitXMLReporter'
   }
   workingDir = 'build/'
}

I couldn't find any indication if this is a known issue. Is there is any change I should make to the gradle script to make gradle 1.11 run my TestNG scripts?

Was it helpful?

Solution

Seems like this is a known bug - check out this known issue in the Gradle 1.11 release notes. See GRADLE-3020.

Changing the suites option like so should allow it to work with 1.11:

suites file('src/test/java/org/open/functional/testng-admin.xml')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top