Skip to content

Instantly share code, notes, and snippets.

@eriwen
Created March 26, 2013 14:47
Show Gist options
  • Save eriwen/5245908 to your computer and use it in GitHub Desktop.
Save eriwen/5245908 to your computer and use it in GitHub Desktop.
Separating tests from integration tests with Gradle
// Usage: gradlew [-Dtest.type=all|unit|integration] test
test {
String testType = System.properties['test.type']
if (testType == 'integration') {
include '**/*IntegrationTest.*'
include '**/*IntegrationSpec.*'
} else if (testType == 'unit') {
include '**/*Test.*'
include '**/*Spec.*'
exclude '**/*IntegrationTest.*'
exclude '**/*IntegrationSpec.*'
} else if (testType == 'all') {
include '**/*Test.*'
include '**/*Spec.*'
} else {
//Default to unit
include '**/*Test.*'
include '**/*Spec.*'
exclude '**/*IntegrationTest.*'
exclude '**/*IntegrationSpec.*'
}
}
// Usage: gradlew integrationTest
task integrationTest(type: Test, description: 'Runs the integration tests', group: 'Verification') {
include '**/*IntegrationTest.*'
include '**/*IntegrationSpec.*'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment