Created
March 3, 2012 22:24
-
-
Save ttddyy/1968643 to your computer and use it in GitHub Desktop.
run multiple jetty before tests in gradle
This file contains 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
// start multiple jetties before test | |
// | |
// useful for parallel web end-to-end testing | |
// | |
import org.gradle.api.plugins.jetty.JettyRun | |
apply plugin: 'java' | |
apply plugin: 'jetty' | |
repositories { | |
mavenCentral() | |
} | |
// configuration for each jetty server | |
def jettyConfigs = [ | |
[port:8001], | |
[port:8002] | |
] | |
def jettyMultiRunTasks = [] | |
// create jetty tasks and assign them | |
jettyConfigs.eachWithIndex {jettyConfig, index -> | |
jettyMultiRunTasks << task("jettyMultiRun-${index}", type: JettyRun) { | |
httpPort = jettyConfig.port | |
daemon = true | |
// more configuration to specify each jetty to use different env... | |
} | |
} | |
test { | |
// start jetties before running tests | |
dependsOn(jettyMultiRunTasks) | |
// more test options such as maxParallelForks, etc. | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment