Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

**DO-NOT-MERGE - Mutation tests setup #100

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ plugins {
id 'org.sonarqube' version '3.4.0.2513'
id 'uk.gov.hmcts.java' version '0.12.27'
id "com.jfrog.bintray" version "1.8.5" apply false
id "info.solidsoft.pitest" version '1.5.1' apply(false)
id "org.jetbrains.gradle.plugin.idea-ext" version "0.7"
id "info.solidsoft.pitest" version '1.5.1' apply false
}

group = 'uk.gov.hmcts.civil.sdt'
Expand Down Expand Up @@ -210,6 +210,8 @@ allprojects {
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombokVersion
implementation group: 'org.projectlombok', name: 'lombok', version: lombokVersion
testImplementation group: 'org.projectlombok', name: 'lombok', version: lombokVersion
testImplementation 'junit:junit:4.13'
testImplementation 'io.rest-assured:rest-assured:4.3.0'

testImplementation ("org.springframework.boot:spring-boot-starter-test"){
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
Expand Down Expand Up @@ -313,6 +315,7 @@ subprojects { subproject ->
apply plugin: 'io.spring.dependency-management'
apply plugin: 'jacoco'
apply plugin: 'uk.gov.hmcts.java'
apply plugin: 'info.solidsoft.pitest'

sourceSets {
unitTest {
Expand Down Expand Up @@ -452,7 +455,6 @@ subprojects { subproject ->
exclude group: 'junit', module: 'junit'
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation group: 'info.solidsoft.gradle.pitest', name: 'gradle-pitest-plugin', version: '1.4.0'
testImplementation group: 'org.easymock', name: 'easymock', version: '5.0.1'
testImplementation group: 'org.jdom', name: 'jdom2', version: '2.0.6.1'
testImplementation group: 'org.dbunit', name: 'dbunit', version: '2.7.3'
Expand All @@ -463,14 +465,18 @@ subprojects { subproject ->
tests to fail when running under openJDK 11.0.17 and above. This dependency can be removed when the bug is fixed.
*/
testImplementation group: 'xerces', name: 'xercesImpl', version: '2.12.2'

testImplementation group: 'org.codehaus.sonar-plugins', name: 'sonar-pitest-plugin', version: '0.5'
}

sonarqube {
properties {
sonarqube {
properties {
property "sonar.sources", "src"
property "sonar.tests", "src"
property "sonar.test.inclusions", "**/unit-test/**,**/integ-test/**"
property "sonar.coverage.jacoco.xmlReportPaths", "${rootDir}/build/reports/jacoco/codeCoverageReport/codeCoverageReport.xml"
property "sonar.pitest.mode", "reuseReport"
property "sonar.pitest.reportsDirectory", "build/reports/pitest"
}
}

Expand Down Expand Up @@ -583,6 +589,25 @@ subprojects { subproject ->

test.finalizedBy jacocoTestReport
check.dependsOn jacocoTestReport

pitest {
// Note: targetClasses and targetTests are defined in each module's build.gradle file
enableDefaultIncrementalAnalysis = true
historyInputLocation = 'build/reports/pitest/fastermutationtesting'
historyOutputLocation = 'build/reports/pitest/fastermutationtestingoutput'
threads = 15
testSourceSets = [sourceSets.unitTest]
fileExtensionsToFilter.addAll('xml', 'json')
outputFormats = ['XML', 'HTML', 'CSV']
mutationThreshold = 0
coverageThreshold = 0
maxMutationsPerClass = 15
jvmArgs = ['-Xms1G', '-Xmx3G']
timestampedReports = false
failWhenNoMutations = false
detectInlinedCode = true
junit5PluginVersion = '0.14'
}
}
// end::subprojects[]

Expand Down
2 changes: 1 addition & 1 deletion config/owasp/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!--Please add all the false positives under the below section-->
<suppress>
<notes>False Positives
CVE-2022-40705 - see https://github.com/jeremylong/DependencyCheck/issues/5543
CVE-2022-40705 - see https://github.com/jeremylong/DependencyCheck/issues/5543
</notes>
<cve>CVE-2022-40705</cve>
</suppress>
Expand Down
18 changes: 6 additions & 12 deletions consumers/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'info.solidsoft.pitest'

jar {
enabled = true
archiveBaseName = 'civil-sdt-consumers'
Expand All @@ -16,18 +14,9 @@ dependencies {
implementation project(':producers')
implementation project(':transformers')
implementation project(':utils')
testImplementation project(':interceptors').sourceSets.unitTest.output
testImplementation project(":domain").sourceSets.unitTest.output
testImplementation project(":producers-api").sourceSets.unitTest.output
testImplementation project(":producers").sourceSets.unitTest.output
testImplementation project(":transformers").sourceSets.unitTest.output

testImplementation project(":utils").sourceSets.unitTest.output

testImplementation project(':interceptors').sourceSets.integTest.output
testImplementation project(":domain").sourceSets.integTest.output
testImplementation project(":producers-api").sourceSets.integTest.output
testImplementation project(":producers").sourceSets.integTest.output
testImplementation project(":transformers").sourceSets.integTest.output
testImplementation project(":utils").sourceSets.integTest.output
}

Expand All @@ -38,3 +27,8 @@ bootJar {
test {
useJUnitPlatform()
}

pitest {
targetClasses = ['uk.gov.moj.sdt.consumers.*']
targetTests = ['uk.gov.moj.sdt.consumers.*']
}
10 changes: 6 additions & 4 deletions dao-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'info.solidsoft.pitest'

jar {
enabled = true
archiveBaseName = 'civil-sdt-dao-api'
Expand All @@ -12,10 +10,9 @@ dependencyCheck {
dependencies {
implementation project(':domain')
implementation project(':utils')
testImplementation project(":domain").sourceSets.unitTest.output

testImplementation project(":utils").sourceSets.unitTest.output

testImplementation project(":domain").sourceSets.integTest.output
testImplementation project(":utils").sourceSets.integTest.output
}

Expand All @@ -30,3 +27,8 @@ tasks.withType(Test) {
sonarqube {
skipProject = true
}

pitest {
targetClasses = ['uk.gov.moj.sdt.dao.api.*']
targetTests = ['uk.gov.moj.sdt.dao.api.*']
}
11 changes: 5 additions & 6 deletions dao/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'info.solidsoft.pitest'

jar {
enabled = true
archiveBaseName = 'civil-sdt-dao'
Expand All @@ -13,12 +11,9 @@ dependencies {
implementation project(':dao-api')
implementation project(':domain')
implementation project(':utils')
testImplementation project(":dao-api").sourceSets.unitTest.output
testImplementation project(":domain").sourceSets.unitTest.output

testImplementation project(":utils").sourceSets.unitTest.output

testImplementation project(":dao-api").sourceSets.integTest.output
testImplementation project(":domain").sourceSets.integTest.output
testImplementation project(":utils").sourceSets.integTest.output
}

Expand All @@ -30,3 +25,7 @@ tasks.withType(Test) {
useJUnitPlatform()
}

pitest {
targetClasses = ['uk.gov.moj.sdt.dao.*']
targetTests = ['uk.gov.moj.sdt.dao.*']
}
9 changes: 6 additions & 3 deletions domain/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
apply plugin: 'info.solidsoft.pitest'

jar {
enabled = true
archiveBaseName = 'civil-sdt-domin'
archiveBaseName = 'civil-sdt-domain'
}

dependencyCheck {
Expand All @@ -22,3 +20,8 @@ bootJar {
test {
useJUnitPlatform()
}

pitest {
targetClasses = ['uk.gov.moj.sdt.domain.*']
targetTests = ['uk.gov.moj.sdt.domain.*']
}
14 changes: 6 additions & 8 deletions handlers-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'info.solidsoft.pitest'

jar {
enabled = true
archiveBaseName = 'civil-sdt-handlers-api'
Expand All @@ -14,15 +12,10 @@ dependencies {
implementation project(":utils")
implementation project(":producers-api")
implementation project(":validators")
testImplementation project(":domain").sourceSets.unitTest.output

testImplementation project(":utils").sourceSets.unitTest.output
testImplementation project(":producers-api").sourceSets.unitTest.output
testImplementation project(":validators").sourceSets.unitTest.output

testImplementation project(":domain").sourceSets.integTest.output
testImplementation project(":utils").sourceSets.integTest.output
testImplementation project(":producers-api").sourceSets.integTest.output
testImplementation project(":validators").sourceSets.integTest.output
}

bootJar {
Expand All @@ -32,3 +25,8 @@ bootJar {
sonarqube {
skipProject = true
}

pitest {
targetClasses = ['uk.gov.moj.sdt.handlers.*']
targetTests = ['uk.gov.moj.sdt.handlers.*']
}
20 changes: 6 additions & 14 deletions handlers/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'info.solidsoft.pitest'

jar {
enabled = true
archiveBaseName = 'civil-sdt-handlers'
Expand All @@ -17,21 +15,10 @@ dependencies {
implementation project(':services-api')
implementation project(':transformers')
implementation project(':validators')
testImplementation project(":domain").sourceSets.unitTest.output
testImplementation project(":handlers-api").sourceSets.unitTest.output
testImplementation project(":producers-api").sourceSets.unitTest.output

testImplementation project(":utils").sourceSets.unitTest.output
testImplementation project(':services-api').sourceSets.unitTest.output
testImplementation project(':transformers').sourceSets.unitTest.output
testImplementation project(':validators').sourceSets.unitTest.output

testImplementation project(":domain").sourceSets.integTest.output
testImplementation project(":handlers-api").sourceSets.integTest.output
testImplementation project(":producers-api").sourceSets.integTest.output
testImplementation project(":utils").sourceSets.integTest.output
testImplementation project(':services-api').sourceSets.integTest.output
testImplementation project(':transformers').sourceSets.integTest.output
testImplementation project(':validators').sourceSets.integTest.output
}

bootJar {
Expand All @@ -41,3 +28,8 @@ bootJar {
test {
useJUnitPlatform()
}

pitest {
targetClasses = ['uk.gov.moj.sdt.handlers.*']
targetTests = ['uk.gov.moj.sdt.handlers.*']
}
14 changes: 6 additions & 8 deletions interceptors/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'info.solidsoft.pitest'

jar {
enabled = true
archiveBaseName = 'civil-sdt-interceptors'
Expand All @@ -14,14 +12,9 @@ dependencies {
implementation project(':dao-api')
implementation project(':domain')
implementation project(':utils')
testImplementation project(":dao").sourceSets.unitTest.output
testImplementation project(":dao-api").sourceSets.unitTest.output
testImplementation project(":domain").sourceSets.unitTest.output

testImplementation project(":utils").sourceSets.unitTest.output

testImplementation project(":dao").sourceSets.integTest.output
testImplementation project(":dao-api").sourceSets.integTest.output
testImplementation project(":domain").sourceSets.integTest.output
testImplementation project(":utils").sourceSets.integTest.output
}

Expand All @@ -32,3 +25,8 @@ bootJar {
test {
useJUnitPlatform()
}

pitest {
targetClasses = ['uk.gov.moj.sdt.interceptors.*']
targetTests = ['uk.gov.moj.sdt.interceptors.*']
}
6 changes: 1 addition & 5 deletions producers-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'info.solidsoft.pitest'

sourceSets.main.java.srcDirs += "src-gen/main/java"

jar {
Expand All @@ -14,10 +12,9 @@ dependencyCheck {
dependencies {
implementation project(':domain')
implementation project(':utils')
testImplementation project(":domain").sourceSets.unitTest.output

testImplementation project(":utils").sourceSets.unitTest.output

testImplementation project(":domain").sourceSets.integTest.output
testImplementation project(":utils").sourceSets.integTest.output
}

Expand Down Expand Up @@ -82,4 +79,3 @@ task targetAppInternalEndpointWsdl2Java(type: JavaExec) {
compileJava.dependsOn 'sdtEndPointWsdl2Java'
compileJava.dependsOn 'sdtInternalEndpointWsdl2Java'
compileJava.dependsOn 'targetAppInternalEndpointWsdl2Java'

2 changes: 0 additions & 2 deletions producers-commissioning/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'info.solidsoft.pitest'

dependencyCheck {
suppressionFile = "${rootDir}/config/owasp/suppressions.xml"
}
Expand Down
16 changes: 6 additions & 10 deletions producers/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'info.solidsoft.pitest'

jar {
enabled = true
archiveBaseName = 'civil-sdt-producers'
Expand All @@ -15,17 +13,10 @@ dependencies {
implementation project(':utils')
implementation project(':producers-api')
implementation project(':handlers-api')
testImplementation project(":handlers").sourceSets.unitTest.output
testImplementation project(":domain").sourceSets.unitTest.output

testImplementation project(":utils").sourceSets.unitTest.output
testImplementation project(':producers-api').sourceSets.unitTest.output
testImplementation project(":handlers-api").sourceSets.unitTest.output

testImplementation project(":handlers").sourceSets.integTest.output
testImplementation project(":domain").sourceSets.integTest.output
testImplementation project(":utils").sourceSets.integTest.output
testImplementation project(':producers-api').sourceSets.integTest.output
testImplementation project(":handlers-api").sourceSets.integTest.output
}

bootJar {
Expand All @@ -35,3 +26,8 @@ bootJar {
test {
useJUnitPlatform()
}

pitest {
targetClasses = ['uk.gov.moj.sdt.producers.*']
targetTests = ['uk.gov.moj.sdt.producers.*']
}
2 changes: 0 additions & 2 deletions sdt-consumer-sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'info.solidsoft.pitest'

dependencyCheck {
suppressionFile = "${rootDir}/config/owasp/suppressions.xml"
}
Expand Down
10 changes: 6 additions & 4 deletions services-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'info.solidsoft.pitest'

jar {
enabled = true
archiveBaseName = 'civil-sdt-services-api'
Expand All @@ -12,10 +10,9 @@ dependencyCheck {
dependencies {
implementation project(':domain')
implementation project(':utils')
testImplementation project(":domain").sourceSets.unitTest.output

testImplementation project(":utils").sourceSets.unitTest.output

testImplementation project(":domain").sourceSets.integTest.output
testImplementation project(":utils").sourceSets.integTest.output
}

Expand All @@ -30,3 +27,8 @@ tasks.withType(Test) {
sonarqube {
skipProject = true
}

pitest {
targetClasses = ['uk.gov.moj.sdt.services.*']
targetTests = ['uk.gov.moj.sdt.services.*']
}
Loading