Skip to content

Commit c6a59f7

Browse files
Adding mutation testing to build gradle with PiTest (#1204)
Signed-off-by: MitchellGale-BitQuill <mitchellg@bitquilltech.com> Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> Co-authored-by: Yury-Fridlyand <yury.fridlyand@improving.com>
1 parent 0e78fb6 commit c6a59f7

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

.github/workflows/sql-test-and-build-workflow.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ jobs:
4444
- name: Build with Gradle
4545
run: ./gradlew --continue build ${{ matrix.entry.os_build_args }}
4646

47+
- name: PiTest with Gradle
48+
run: |
49+
./gradlew :core:pitest
50+
./gradlew :opensearch:pitest
51+
52+
4753
- name: Run backward compatibility tests
4854
if: ${{ matrix.entry.os == 'ubuntu-latest' }}
4955
run: ./scripts/bwctest.sh

DEVELOPER_GUIDE.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,12 @@ Most of the time you just need to run ./gradlew build which will make sure you p
220220
- Run all unit tests.
221221
* - ./gradlew :integ-test:integTest
222222
- Run all integration test (this takes time).
223+
* - ./gradlew :doctest:doctest
224+
- Run doctests
223225
* - ./gradlew build
224226
- Build plugin by run all tasks above (this takes time).
227+
* - ./gradlew pitest
228+
- Run PiTest mutation testing (see more info in `#1204 <https://github.com/opensearch-project/sql/pull/1204>`_)
225229

226230
For integration test, you can use ``-Dtests.class`` “UT full path” to run a task individually. For example ``./gradlew :integ-test:integTest -Dtests.class="*QueryIT"``.
227231

core/build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,23 @@ plugins {
2626
id 'java-library'
2727
id "io.freefair.lombok"
2828
id 'jacoco'
29+
id 'info.solidsoft.pitest' version '1.9.0'
2930
id 'java-test-fixtures'
3031
}
3132

3233
repositories {
3334
mavenCentral()
3435
}
3536

37+
pitest {
38+
targetClasses = ['org.opensearch.sql.*']
39+
pitestVersion = '1.9.0'
40+
threads = 4
41+
outputFormats = ['HTML', 'XML']
42+
timestampedReports = false
43+
junit5PluginVersion = '1.0.0'
44+
}
45+
3646
dependencies {
3747
api group: 'com.google.guava', name: 'guava', version: '31.0.1-jre'
3848
api group: 'org.apache.commons', name: 'commons-lang3', version: '3.10'

opensearch/build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ plugins {
2626
id 'java-library'
2727
id "io.freefair.lombok"
2828
id 'jacoco'
29+
id 'info.solidsoft.pitest' version '1.9.0'
2930
}
3031

3132
dependencies {
@@ -47,6 +48,15 @@ dependencies {
4748
testImplementation group: 'org.opensearch.test', name: 'framework', version: "${opensearch_version}"
4849
}
4950

51+
pitest {
52+
targetClasses = ['org.opensearch.sql.*']
53+
pitestVersion = '1.9.0'
54+
threads = 4
55+
outputFormats = ['HTML', 'XML']
56+
timestampedReports = false
57+
junit5PluginVersion = '1.0.0'
58+
}
59+
5060
test {
5161
useJUnitPlatform()
5262
testLogging {

0 commit comments

Comments
 (0)