-
-
Save Rubentxu/3138e8abd15ec233d211ba50f3d846a9 to your computer and use it in GitHub Desktop.
Separating tests from integration tests with Gradle
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
// 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