0

I'm following the example from http://www.gebish.org/manual/0.9.2/sauce-labs.html#gradle_geb_saucelabs_plugin but am unable to get it working. My build.gradle script is as follows:

buildscript {
  repositories {
    jcenter()
  }
  dependencies {
    classpath "org.grails:grails-gradle-plugin:2.0.0"
    classpath 'org.gebish:geb-gradle:0.9.2'
  }
}

version "0.1"
group "example"

apply plugin: "grails"
apply plugin: "geb-saucelabs"

repositories {
  grails.central() //creates a maven repo for the Grails Central repository (Core libraries and plugins)
  maven { url "http://repository-saucelabs.forge.cloudbees.com/release" }
}

grails {
  grailsVersion = '2.3.5'
  groovyVersion = '2.1.9'
  springLoadedVersion '1.1.3'
}

dependencies {
  bootstrap "org.grails.plugins:tomcat:7.0.50" // No container is deployed by default, so add this
  compile 'org.grails.plugins:resources:1.2' // Just an example of adding a Grails plugin
  sauceConnect "com.saucelabs:sauce-connect:3.0.28"
}

sauceLabs {
    browsers { //5
        firefox_linux_19 //Could not find property 'reporting' on root project 'gradleGrailsError'.
        chrome_mac
        internetExplorer_vista_9
    }
    task { //6
        testClassesDir = test.testClassesDir
        testSrcDirs = test.testSrcDirs
        classpath = test.classpath
    }
    account { //7
        username = System.getenv("SAUCE_ONDEMAND_USERNAME")
        accessKey = System.getenv("SAUCE_ONDEMAND_ACCESS_KEY")
    }
}

When I run $gradle test, I get the following error: Could not find property 'reporting' on root project... This error occurs on the line which specifies firefox_linux_19 as the browser. Can someone please advise how I can get the geb-saucelabs plugin working correctly? Thanks.

user3240644
  • 1,991
  • 2
  • 20
  • 33

1 Answers1

0

After a lot of trial and error, I got the following to work:

sauceLabs {    
     tasks.withType(Test) {
        reports.junitXml.destination = reporting.file("test-results/$name")
        reports.html.destination = reporting.file("test-reports/$name")
     }
     browsers { //5
        firefox_linux_19
        chrome_mac
        internetExplorer_vista_9
     }   
     account { //7
         username = System.getenv("SAUCE_ONDEMAND_USERNAME")
         accessKey = System.getenv("SAUCE_ONDEMAND_ACCESS_KEY")
     }
}

The addition of the tasks.withType(Test) was the key, and I also removed the task closure which was listed in the sample code.

Ross Rowe
  • 397
  • 4
  • 9