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

Adding mutation testing to build gradle with PiTest #1204

Merged
Merged
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
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.springframework', name: 'spring-context', version: "${spring_version}"
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