apply plugin: 'java' apply plugin: 'eclipse' apply from: rootProject.file('gradle/emma.gradle'); // By default, the test task is skipped, unless serverTest is true // To run build from command line: // gradle -DserverTest=true clean test eclipse.project.name="search-integ-tests" repositories { mavenCentral() maven { name 'spring-test-mvc' url 'http://repo.springsource.org/libs-snapshot' } maven { name 'codehaus-release-repo' url 'http://repository.codehaus.org' } } sourceSets { test { java.srcDir file('src/test/java') resources.srcDir file('src/test/resources') } } tasks.withType(Test) { ignoreFailures = false } test.onlyIf { Boolean.getBoolean('serverTest') } compileTestJava.options.encoding = 'utf-8' dependencies { testCompile project(':webapp') compile "commons-io:commons-io:2.0.1" testCompile "org.springframework:spring-test-mvc:1.0.0.BUILD-SNAPSHOT" testCompile("org.uncommons:reportng:1.1.2") { exclude group: "org.testng", module: "testng" } } task teardown << { def teardownProc = "bash ${project.file("./test-teardown.sh")}".execute(); teardownProc.waitFor(); def output=teardownProc.in.text; logger.quiet("${output}"); } test { doFirst { sourceSets.main.java.srcDirs = ["$buildDir/reportSource/main/java"]; def setupProc = "bash ${project.file("./test-setup.sh")}".execute(); setupProc.waitFor(); def output=setupProc.in.text; logger.quiet("${output}"); } useTestNG() options { listeners << 'org.uncommons.reportng.HTMLReporter' listeners << 'org.uncommons.reportng.JUnitXMLReporter' listeners << 'org.testng.reporters.XMLReporter' } include '**/*' finalizedBy teardown } task mkBuildDir << { def classesDir = new File(project.buildDir, "classes/main") if (!classesDir.exists()) classesDir.mkdirs() } task copyClasses(type: Copy, dependsOn: [mkBuildDir]){ from "../webapp/build/classes/main" into "${buildDir}/classes/main" } task mkReportSourceDir << { def dir = new File("${project.buildDir}/reportSource/main") if (!dir.exists()) dir.mkdirs() } task copySources(type: Copy, dependsOn: [mkReportSourceDir]){ from "../webapp/src/main" into "${buildDir}/reportSource/main" } testClasses.dependsOn([copyClasses,copySources])