Created
June 23, 2015 14:24
-
-
Save hgontijo/3eea875fe42748b01266 to your computer and use it in GitHub Desktop.
gradle script to execute tests by consuming an external jar.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apply plugin: 'java' | |
| project.ext.set('testIncludeDefault', 'com/vmware/ui/login/**') | |
| repositories { | |
| mavenCentral() | |
| } | |
| dependencies { | |
| runtime fileTree(dir: 'libs', include: ['*.jar']) | |
| } | |
| configurations { | |
| provided | |
| testRuntime.extendsFrom(provided) | |
| } | |
| task expandDependencies << { | |
| def includes = System.getProperty('testInclude', project.testIncludeDefault) | |
| FileTree tree = fileTree(dir: 'libs', include: '*.jar') | |
| tree.visit { element -> | |
| println "Unpacking $element.relativePath => $element.file" | |
| ant.unzip(src: element.file, dest: "$buildDir/classes/test") { | |
| patternset() { | |
| include(name: includes) | |
| exclude(name: 'META-INF/**') | |
| exclude(name: 'LICENSE') | |
| exclude(name: 'NOTICE') | |
| } | |
| } | |
| } | |
| } | |
| test { | |
| dependsOn expandDependencies | |
| useTestNG() { } | |
| // Pass along current system properties since test are executed in a forked JVM | |
| systemProperties System.properties | |
| logger.debug "systemProperties: ${systemProperties}" | |
| include System.getProperty('testInclude', project.testIncludeDefault) | |
| // maxParallelForks=5 | |
| onOutput { descriptor, event -> | |
| logger.lifecycle(event.message ) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment