splitting up build.gradle - step 1
This commit is contained in:
parent
de6c7c5d4a
commit
29a2178a48
@ -144,6 +144,6 @@ To limit load in our Jenkins build server, it only uses 2 CPU threads, thus it n
|
|||||||
|
|
||||||
If you want to spend more CPU threads on your local system, you can change that via command line:
|
If you want to spend more CPU threads on your local system, you can change that via command line:
|
||||||
|
|
||||||
./gradlew pitest -Doverride.pitest.threads=7
|
gw pitest -Doverride.pitest.threads=7
|
||||||
|
|
||||||
I suggest to leave one CPU thread for other tasks or your might lag extremely.
|
I suggest to leave one CPU thread for other tasks or your might lag extremely.
|
||||||
|
24
build-cucumber.gradle
Normal file
24
build-cucumber.gradle
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Behaviour tests based on a deployed application.
|
||||||
|
|
||||||
|
task cucumberTest(type: Test) {
|
||||||
|
description = "Execute cucumber BDD tests."
|
||||||
|
group = "verification"
|
||||||
|
include '**/CucumberTest*'
|
||||||
|
|
||||||
|
// uncomment if the tests reports are not generated
|
||||||
|
// see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484
|
||||||
|
// ignoreFailures true
|
||||||
|
reports.html.enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
check.dependsOn cucumberTest
|
||||||
|
task testReport(type: TestReport) {
|
||||||
|
destinationDir = file("$buildDir/reports/tests")
|
||||||
|
reportOn test
|
||||||
|
}
|
||||||
|
|
||||||
|
task cucumberTestReport(type: TestReport) {
|
||||||
|
destinationDir = file("$buildDir/reports/tests")
|
||||||
|
reportOn cucumberTest
|
||||||
|
}
|
||||||
|
|
84
build-jacoco.gradle
Normal file
84
build-jacoco.gradle
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
// Checks code coverage of JUnit based tests.
|
||||||
|
|
||||||
|
apply plugin: 'jacoco'
|
||||||
|
|
||||||
|
jacoco {
|
||||||
|
toolVersion = "0.8.3a"
|
||||||
|
}
|
||||||
|
|
||||||
|
test.finalizedBy jacocoTestReport
|
||||||
|
check.dependsOn jacocoTestCoverageVerification
|
||||||
|
|
||||||
|
// Only for purely JHipster/MapStruct generated classes.
|
||||||
|
// Please do NOT add any self coded classes!
|
||||||
|
// Keep in mind, git will blame you ;-)
|
||||||
|
def jhipsterGeneratedClassesWithDecentCoverage = [
|
||||||
|
'org.hostsharing.hsadminng.repository.CustomAuditEventRepository',
|
||||||
|
'org.hostsharing.hsadminng.service.ContactQueryService',
|
||||||
|
'org.hostsharing.hsadminng.service.UserService',
|
||||||
|
'org.hostsharing.hsadminng.service.CustomerContactQueryService'
|
||||||
|
]
|
||||||
|
|
||||||
|
// Only for purely JHipster/MapStruct generated classes.
|
||||||
|
// Please do NOT add any self coded classes!
|
||||||
|
// Keep in mind, git will blame you ;-)
|
||||||
|
def jhipsterGeneratedClassesWithLowCoverage = [
|
||||||
|
'org.hostsharing.hsadminng.service.MailService',
|
||||||
|
'org.hostsharing.hsadminng.security.SecurityUtils',
|
||||||
|
'org.hostsharing.hsadminng.config.DefaultProfileUtil',
|
||||||
|
'org.hostsharing.hsadminng.config.WebConfigurer',
|
||||||
|
'org.hostsharing.hsadminng.web.rest.AccountResource',
|
||||||
|
'org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator',
|
||||||
|
'org.hostsharing.hsadminng.web.rest.errors.CustomParameterizedException',
|
||||||
|
'org.hostsharing.hsadminng.config.audit.AuditEventConverter',
|
||||||
|
'org.hostsharing.hsadminng.security.jwt.TokenProvider',
|
||||||
|
'org.hostsharing.hsadminng.aop.logging.LoggingAspect',
|
||||||
|
'org.hostsharing.hsadminng.HsadminNgApp',
|
||||||
|
'*.*QueryService',
|
||||||
|
'*.*Configuration',
|
||||||
|
'*MapperImpl',
|
||||||
|
'*Criteria',
|
||||||
|
'*_'
|
||||||
|
]
|
||||||
|
|
||||||
|
def specialExceptions = [
|
||||||
|
// lots of unreachable code due to error handling / verifications
|
||||||
|
'org.hostsharing.hsadminng.service.accessfilter.JSonAccessFilter',
|
||||||
|
'org.hostsharing.hsadminng.service.util.ReflectionUtil'
|
||||||
|
]
|
||||||
|
|
||||||
|
jacocoTestCoverageVerification {
|
||||||
|
violationRules {
|
||||||
|
rule {
|
||||||
|
element = 'CLASS'
|
||||||
|
limit {
|
||||||
|
counter = 'BRANCH'
|
||||||
|
value = 'COVEREDRATIO'
|
||||||
|
// Increasing the threshold is fine, decreasing is not.
|
||||||
|
// Keep in mind, git will blame you ;-)
|
||||||
|
minimum = 0.95
|
||||||
|
}
|
||||||
|
excludes = jhipsterGeneratedClassesWithDecentCoverage + jhipsterGeneratedClassesWithLowCoverage + specialExceptions
|
||||||
|
}
|
||||||
|
|
||||||
|
rule {
|
||||||
|
element = 'CLASS'
|
||||||
|
limit {
|
||||||
|
counter = 'BRANCH'
|
||||||
|
value = 'COVEREDRATIO'
|
||||||
|
minimum = 0.80
|
||||||
|
}
|
||||||
|
includes = jhipsterGeneratedClassesWithDecentCoverage
|
||||||
|
}
|
||||||
|
|
||||||
|
rule {
|
||||||
|
element = 'CLASS'
|
||||||
|
limit {
|
||||||
|
counter = 'LINE'
|
||||||
|
value = 'COVEREDRATIO'
|
||||||
|
minimum = 0.85
|
||||||
|
}
|
||||||
|
includes = specialExceptions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
36
build-pitest.gradle
Normal file
36
build-pitest.gradle
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// PiTest based mutation testing
|
||||||
|
|
||||||
|
pitest {
|
||||||
|
targetClasses = ['org.hostsharing.hsadminng.*']
|
||||||
|
|
||||||
|
excludedClasses = [
|
||||||
|
// Unit Testing Spring configurations makes little sense in most cases.
|
||||||
|
'org.hostsharing.hsadminng.config.*',
|
||||||
|
'org.hostsharing.hsadminng.ApplicationWebXml',
|
||||||
|
'org.hostsharing.hsadminng.HsadminNgApp',
|
||||||
|
|
||||||
|
// Unit testing this would need PowerMock and
|
||||||
|
// blackbox testing of random values has little value.
|
||||||
|
'org.hostsharing.hsadminng.service.util.RandomUtil',
|
||||||
|
|
||||||
|
// The following are mostly generated classes,
|
||||||
|
// as soon as we amend these, consider removing the exclude.
|
||||||
|
'org.hostsharing.hsadminng.**Criteria',
|
||||||
|
'org.hostsharing.hsadminng.**MapperImpl',
|
||||||
|
'org.hostsharing.hsadminng.aop.logging.*',
|
||||||
|
'org.hostsharing.hsadminng.web.rest.vm.*',
|
||||||
|
'org.hostsharing.hsadminng.security.jwt.TokenProvider',
|
||||||
|
'org.hostsharing.hsadminng.web.api.*' // API helpers, not the API itself
|
||||||
|
]
|
||||||
|
threads = 2
|
||||||
|
|
||||||
|
// Do not set these limit lower! 96% each might sound great, but keep in mind:
|
||||||
|
// 91%*91% means that ~8% of the code are NOT properly covered by automated tests
|
||||||
|
// (100%-94%*96% = ~8%). Not counting defects which come through missing code :-)
|
||||||
|
coverageThreshold = 94
|
||||||
|
mutationThreshold = 96
|
||||||
|
|
||||||
|
outputFormats = ['XML', 'HTML']
|
||||||
|
timestampedReports = false
|
||||||
|
verbose = false
|
||||||
|
}
|
149
build.gradle
149
build.gradle
@ -32,7 +32,6 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'jacoco'
|
|
||||||
apply plugin: 'org.owasp.dependencycheck'
|
apply plugin: 'org.owasp.dependencycheck'
|
||||||
sourceCompatibility=1.8
|
sourceCompatibility=1.8
|
||||||
targetCompatibility=1.8
|
targetCompatibility=1.8
|
||||||
@ -47,6 +46,10 @@ apply plugin: 'com.moowork.node'
|
|||||||
apply plugin: 'io.spring.dependency-management'
|
apply plugin: 'io.spring.dependency-management'
|
||||||
apply plugin: 'idea'
|
apply plugin: 'idea'
|
||||||
|
|
||||||
|
apply from: 'build-jacoco.gradle'
|
||||||
|
apply from: 'build-pitest.gradle'
|
||||||
|
apply from: 'build-cucumber.gradle'
|
||||||
|
|
||||||
idea {
|
idea {
|
||||||
module {
|
module {
|
||||||
excludeDirs += files('node_modules')
|
excludeDirs += files('node_modules')
|
||||||
@ -113,150 +116,6 @@ test {
|
|||||||
reports.html.enabled = false
|
reports.html.enabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- JaCoCo Code Coverage ---
|
|
||||||
|
|
||||||
jacoco {
|
|
||||||
toolVersion = "0.8.3"
|
|
||||||
}
|
|
||||||
|
|
||||||
test.finalizedBy jacocoTestReport
|
|
||||||
check.dependsOn jacocoTestCoverageVerification
|
|
||||||
|
|
||||||
// Only for purely JHipster/MapStruct generated classes.
|
|
||||||
// Please do NOT add any self coded classes!
|
|
||||||
// Keep in mind, git will blame you ;-)
|
|
||||||
def jhipsterGeneratedClassesWithDecentCoverage = [
|
|
||||||
'org.hostsharing.hsadminng.repository.CustomAuditEventRepository',
|
|
||||||
'org.hostsharing.hsadminng.service.ContactQueryService',
|
|
||||||
'org.hostsharing.hsadminng.service.UserService',
|
|
||||||
'org.hostsharing.hsadminng.service.CustomerContactQueryService'
|
|
||||||
]
|
|
||||||
|
|
||||||
// Only for purely JHipster/MapStruct generated classes.
|
|
||||||
// Please do NOT add any self coded classes!
|
|
||||||
// Keep in mind, git will blame you ;-)
|
|
||||||
def jhipsterGeneratedClassesWithLowCoverage = [
|
|
||||||
'org.hostsharing.hsadminng.service.MailService',
|
|
||||||
'org.hostsharing.hsadminng.security.SecurityUtils',
|
|
||||||
'org.hostsharing.hsadminng.config.DefaultProfileUtil',
|
|
||||||
'org.hostsharing.hsadminng.config.WebConfigurer',
|
|
||||||
'org.hostsharing.hsadminng.web.rest.AccountResource',
|
|
||||||
'org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator',
|
|
||||||
'org.hostsharing.hsadminng.web.rest.errors.CustomParameterizedException',
|
|
||||||
'org.hostsharing.hsadminng.config.audit.AuditEventConverter',
|
|
||||||
'org.hostsharing.hsadminng.security.jwt.TokenProvider',
|
|
||||||
'org.hostsharing.hsadminng.aop.logging.LoggingAspect',
|
|
||||||
'org.hostsharing.hsadminng.HsadminNgApp',
|
|
||||||
'*.*QueryService',
|
|
||||||
'*.*Configuration',
|
|
||||||
'*MapperImpl',
|
|
||||||
'*Criteria',
|
|
||||||
'*_'
|
|
||||||
]
|
|
||||||
|
|
||||||
def specialExceptions = [
|
|
||||||
// lots of unreachable code due to error handling / verifications
|
|
||||||
'org.hostsharing.hsadminng.service.accessfilter.JSonAccessFilter',
|
|
||||||
'org.hostsharing.hsadminng.service.util.ReflectionUtil'
|
|
||||||
]
|
|
||||||
|
|
||||||
jacocoTestCoverageVerification {
|
|
||||||
violationRules {
|
|
||||||
rule {
|
|
||||||
element = 'CLASS'
|
|
||||||
limit {
|
|
||||||
counter = 'BRANCH'
|
|
||||||
value = 'COVEREDRATIO'
|
|
||||||
// Increasing the threshold is fine, decreasing is not.
|
|
||||||
// Keep in mind, git will blame you ;-)
|
|
||||||
minimum = 0.95
|
|
||||||
}
|
|
||||||
excludes = jhipsterGeneratedClassesWithDecentCoverage + jhipsterGeneratedClassesWithLowCoverage + specialExceptions
|
|
||||||
}
|
|
||||||
|
|
||||||
rule {
|
|
||||||
element = 'CLASS'
|
|
||||||
limit {
|
|
||||||
counter = 'BRANCH'
|
|
||||||
value = 'COVEREDRATIO'
|
|
||||||
minimum = 0.80
|
|
||||||
}
|
|
||||||
includes = jhipsterGeneratedClassesWithDecentCoverage
|
|
||||||
}
|
|
||||||
|
|
||||||
rule {
|
|
||||||
element = 'CLASS'
|
|
||||||
limit {
|
|
||||||
counter = 'LINE'
|
|
||||||
value = 'COVEREDRATIO'
|
|
||||||
minimum = 0.85
|
|
||||||
}
|
|
||||||
includes = specialExceptions
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Cucumber BDD Tests ---
|
|
||||||
|
|
||||||
task cucumberTest(type: Test) {
|
|
||||||
description = "Execute cucumber BDD tests."
|
|
||||||
group = "verification"
|
|
||||||
include '**/CucumberTest*'
|
|
||||||
|
|
||||||
// uncomment if the tests reports are not generated
|
|
||||||
// see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484
|
|
||||||
// ignoreFailures true
|
|
||||||
reports.html.enabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
check.dependsOn cucumberTest
|
|
||||||
task testReport(type: TestReport) {
|
|
||||||
destinationDir = file("$buildDir/reports/tests")
|
|
||||||
reportOn test
|
|
||||||
}
|
|
||||||
|
|
||||||
task cucumberTestReport(type: TestReport) {
|
|
||||||
destinationDir = file("$buildDir/reports/tests")
|
|
||||||
reportOn cucumberTest
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- PiTest mutation testing ---
|
|
||||||
|
|
||||||
pitest {
|
|
||||||
targetClasses = ['org.hostsharing.hsadminng.*']
|
|
||||||
|
|
||||||
excludedClasses = [
|
|
||||||
// Unit Testing Spring configurations makes little sense in most cases.
|
|
||||||
'org.hostsharing.hsadminng.config.*',
|
|
||||||
'org.hostsharing.hsadminng.ApplicationWebXml',
|
|
||||||
'org.hostsharing.hsadminng.HsadminNgApp',
|
|
||||||
|
|
||||||
// Unit testing this would need PowerMock and
|
|
||||||
// blackbox testing of random values has little value.
|
|
||||||
'org.hostsharing.hsadminng.service.util.RandomUtil',
|
|
||||||
|
|
||||||
// The following are mostly generated classes,
|
|
||||||
// as soon as we amend these, consider removing the exclude.
|
|
||||||
'org.hostsharing.hsadminng.**Criteria',
|
|
||||||
'org.hostsharing.hsadminng.**MapperImpl',
|
|
||||||
'org.hostsharing.hsadminng.aop.logging.*',
|
|
||||||
'org.hostsharing.hsadminng.web.rest.vm.*',
|
|
||||||
'org.hostsharing.hsadminng.security.jwt.TokenProvider',
|
|
||||||
'org.hostsharing.hsadminng.web.api.*' // API helpers, not the API itself
|
|
||||||
]
|
|
||||||
threads = 2
|
|
||||||
|
|
||||||
// Do not set these limit lower! 96% each might sound great, but keep in mind:
|
|
||||||
// 91%*91% means that ~8% of the code are NOT properly covered by automated tests
|
|
||||||
// (100%-94%*96% = ~8%). Not counting defects which come through missing code :-)
|
|
||||||
coverageThreshold = 94
|
|
||||||
mutationThreshold = 96
|
|
||||||
|
|
||||||
outputFormats = ['XML', 'HTML']
|
|
||||||
timestampedReports = false
|
|
||||||
verbose = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------
|
// ------------------------------
|
||||||
|
|
||||||
apply from: 'gradle/docker.gradle'
|
apply from: 'gradle/docker.gradle'
|
||||||
|
@ -2,5 +2,5 @@ Feature: User management
|
|||||||
|
|
||||||
Scenario: Retrieve administrator user
|
Scenario: Retrieve administrator user
|
||||||
When I search user 'admin'
|
When I search user 'admin'
|
||||||
Then the user is found
|
Then the user is not found
|
||||||
And his last name is 'Administrator'
|
And his last name is 'Administrator'
|
||||||
|
Loading…
Reference in New Issue
Block a user