Skip to content

Commit

Permalink
Adding mutation testing to build gradle with PiTest (#1204)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
MitchellGale and Yury-Fridlyand authored Jan 11, 2023
1 parent 0e78fb6 commit c6a59f7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/sql-test-and-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ jobs:
- name: Build with Gradle
run: ./gradlew --continue build ${{ matrix.entry.os_build_args }}

- name: PiTest with Gradle
run: |
./gradlew :core:pitest
./gradlew :opensearch:pitest

- name: Run backward compatibility tests
if: ${{ matrix.entry.os == 'ubuntu-latest' }}
run: ./scripts/bwctest.sh
Expand Down
4 changes: 4 additions & 0 deletions DEVELOPER_GUIDE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,12 @@ Most of the time you just need to run ./gradlew build which will make sure you p
- Run all unit tests.
* - ./gradlew :integ-test:integTest
- Run all integration test (this takes time).
* - ./gradlew :doctest:doctest
- Run doctests
* - ./gradlew build
- Build plugin by run all tasks above (this takes time).
* - ./gradlew pitest
- Run PiTest mutation testing (see more info in `#1204 <https://github.com/opensearch-project/sql/pull/1204>`_)

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"``.

Expand Down
10 changes: 10 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,23 @@ plugins {
id 'java-library'
id "io.freefair.lombok"
id 'jacoco'
id 'info.solidsoft.pitest' version '1.9.0'
id 'java-test-fixtures'
}

repositories {
mavenCentral()
}

pitest {
targetClasses = ['org.opensearch.sql.*']
pitestVersion = '1.9.0'
threads = 4
outputFormats = ['HTML', 'XML']
timestampedReports = false
junit5PluginVersion = '1.0.0'
}

dependencies {
api group: 'com.google.guava', name: 'guava', version: '31.0.1-jre'
api group: 'org.apache.commons', name: 'commons-lang3', version: '3.10'
Expand Down
10 changes: 10 additions & 0 deletions opensearch/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ plugins {
id 'java-library'
id "io.freefair.lombok"
id 'jacoco'
id 'info.solidsoft.pitest' version '1.9.0'
}

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

pitest {
targetClasses = ['org.opensearch.sql.*']
pitestVersion = '1.9.0'
threads = 4
outputFormats = ['HTML', 'XML']
timestampedReports = false
junit5PluginVersion = '1.0.0'
}

test {
useJUnitPlatform()
testLogging {
Expand Down

0 comments on commit c6a59f7

Please sign in to comment.