From: Gustavo Martin Morcuende Date: Mon, 23 Jan 2017 11:58:44 +0000 (+0100) Subject: Big build-BOM.gradle file. X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=a40d3f2c9f754f40a030b56d9aabe8616a2eebf6;p=JavaForFun Big build-BOM.gradle file. --- diff --git a/SpringJava/Gradle/build-BOM-1.0-SNAPSHOT.gradle b/SpringJava/Gradle/build-BOM-1.0-SNAPSHOT.gradle index f4391ee..b121525 100644 --- a/SpringJava/Gradle/build-BOM-1.0-SNAPSHOT.gradle +++ b/SpringJava/Gradle/build-BOM-1.0-SNAPSHOT.gradle @@ -179,10 +179,83 @@ subprojects { } + + // ***************** UNIT TESTS, COMMON CONFIGURATION ***************** + test { + + // explicitly include or exclude tests + exclude '**/*IntegrationShould.class' + + testLogging { + events "PASSED", "FAILED", "SKIPPED" + } + + jacoco { + append = false + destinationFile = file("$buildDir/jacoco/jacoco.exec") + classDumpFile = file("$buildDir/jacoco/classpathdumps") + } + } + + + // ***************** INTEGRATION TESTS, COMMON CONFIGURATION ***************** + // Using another directory for integration tests enable me to run all the unit tests quickly from my IDE (InteliJ or Eclipse) + // If I had in the same directory both types of test when I want to run all the unit tests from the root of the src/test directory + // I would be also running the integration tests, and they are slower :( + + // Integration tests will be located in this path: src/integTest + sourceSets { + integTest { + compileClasspath += main.output + test.output + runtimeClasspath += main.output + test.output + output.classesDir = test.output.classesDir + output.resourcesDir = test.output.resourcesDir + } + } + + configurations { + integTestCompile.extendsFrom testCompile + integTestRuntime.extendsFrom testRuntime + } + + + task integTest(type: Test) { + // dependsOn startApp + // finalizedBy stopApp + description = 'Runs integration tests'; + group = 'verification'; + + testClassesDir = sourceSets.integTest.output.classesDir + classpath = sourceSets.integTest.runtimeClasspath + reports.junitXml.destination = "${buildDir}/test-results/test" + + + + // explicitly include or exclude tests + filter { + includeTestsMatching "*IntegrationShould" + failOnNoMatchingTests = false + } + + testLogging { + events "PASSED", "FAILED", "SKIPPED" + } + + jacoco { + append = false + destinationFile = file("$buildDir/jacoco/jacoco-it.exec") + classDumpFile = file("$buildDir/jacoco/classpathIntegdumps") + } + + // mustRunAfter test + } + + project.tasks.check.dependsOn(integTest) + + + // ***************** COVERAGE ***************** apply plugin: 'jacoco' - apply from: "$rootProject.projectDir/build-test.gradle" - apply from: "$rootProject.projectDir/build-integTest.gradle" jacoco { toolVersion = '0.7.6.201602180812' diff --git a/SpringJava/Gradle/build-integTest.gradle b/SpringJava/Gradle/build-integTest.gradle deleted file mode 100644 index e4c69fd..0000000 --- a/SpringJava/Gradle/build-integTest.gradle +++ /dev/null @@ -1,55 +0,0 @@ - -// ***************** INTEGRATION TESTS, COMMON CONFIGURATION ***************** - -// Using another directory for integration tests enable me to run all the unit tests quickly from my IDE (InteliJ or Eclipse) -// If I had in the same directory both types of test when I want to run all the unit tests from the root of the src/test directory -// I would be also running the integration tests, and they are slower :( - -// Integration tests will be located in this path: src/integTest -sourceSets { - integTest { - compileClasspath += main.output + test.output - runtimeClasspath += main.output + test.output - output.classesDir = test.output.classesDir - output.resourcesDir = test.output.resourcesDir - } -} - -configurations { - integTestCompile.extendsFrom testCompile - integTestRuntime.extendsFrom testRuntime -} - - -task integTest(type: Test) { - // dependsOn startApp - // finalizedBy stopApp - description = 'Runs integration tests'; - group = 'verification'; - - testClassesDir = sourceSets.integTest.output.classesDir - classpath = sourceSets.integTest.runtimeClasspath - reports.junitXml.destination = "${buildDir}/test-results/test" - - - - // explicitly include or exclude tests - filter { - includeTestsMatching "*IntegrationShould" - failOnNoMatchingTests = false - } - - testLogging { - events "PASSED", "FAILED", "SKIPPED" - } - - jacoco { - append = false - destinationFile = file("$buildDir/jacoco/jacoco-it.exec") - classDumpFile = file("$buildDir/jacoco/classpathIntegdumps") - } - - // mustRunAfter test -} - -project.tasks.check.dependsOn(integTest) diff --git a/SpringJava/Gradle/build-test.gradle b/SpringJava/Gradle/build-test.gradle deleted file mode 100644 index 5ee6dad..0000000 --- a/SpringJava/Gradle/build-test.gradle +++ /dev/null @@ -1,19 +0,0 @@ - -// ***************** UNIT TESTS, COMMON CONFIGURATION ***************** - -test { - - // explicitly include or exclude tests - exclude '**/*IntegrationShould.class' - - testLogging { - events "PASSED", "FAILED", "SKIPPED" - } - - jacoco { - append = false - destinationFile = file("$buildDir/jacoco/jacoco.exec") - classDumpFile = file("$buildDir/jacoco/classpathdumps") - } -} -