diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 082931e9ac..d983ca7e10 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: ''
-labels: ''
+labels: 'bug'
assignees: ''
---
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
index c5998337e0..7cc9d64348 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -2,7 +2,7 @@
name: Feature request
about: Suggest an idea for the UTBot project
title: ''
-labels: ''
+labels: 'enhancement'
assignees: ''
---
diff --git a/.github/ISSUE_TEMPLATE/test_request.md b/.github/ISSUE_TEMPLATE/test_request.md
index b93ca59e79..ff1d8069c3 100644
--- a/.github/ISSUE_TEMPLATE/test_request.md
+++ b/.github/ISSUE_TEMPLATE/test_request.md
@@ -1,8 +1,8 @@
---
name: Manual testing checklist
about: Checklist of testing process
-title: ''
-labels: ''
+title: 'Manual testing of build#'
+labels: 'qa'
assignees: ''
---
@@ -11,7 +11,9 @@ assignees: ''
*Check that the IntelliJ Idea UTBot plugin can be successfully installed*
-- [ ] Choose appropriate workflow from the next list (by default, use the latest one) https://github.com/UnitTestBot/UTBotJava/actions/workflows/publish-plugin-and-cli.yml
+- [ ] Choose appropriate workflow from the list (by default, filter by main branch and take the latest one) https://github.com/UnitTestBot/UTBotJava/actions/workflows/publish-plugin-and-cli.yml
+- [ ] Download plugin
+- [ ] Check downloaded zip-file size < 100 MB
- [ ] Open IntelliJ IDE
- [ ] Remove previously installed UTBot plugin
- [ ] Clone or reuse UTBot project (https://github.com/UnitTestBot/UTBotJava.git)
@@ -26,31 +28,28 @@ assignees: ''
- [ ] Open the utbot-sample/src/main/java/org/utbot/examples/algorithms/ArraysQuickSort.java file
- [ ] Generate tests for the class
- [ ] Remove results
-- [ ] Generate tests for the methods
+- [ ] Generate and Run test for a method
-
**Manual scenario #2**
- [ ] Use default plugin settings
- [ ] Open the utbot-sample/src/main/java/org/utbot/examples/mock/CommonMocksExample.java file
-- [ ] Generate tests with all available (mocking) options
+- [ ] Generate tests with different Mocking options combinations
-
**Manual scenario #3**
-- [ ] Create a new Gradle project
+- [ ] Create a new Gradle project with JDK 8
- [ ] Add a simple java file to test
-- [ ] Generate a test with a new test root
+- [ ] Generate a test in the existing test root
-
**Manual scenario #4**
-- [ ] Create a new Maven project
+- [ ] Create a new Maven project with JDK 8
- [ ] Add a simple java file to test
- [ ] Generate a test with a new test root
**Manual scenario #5**
-- [ ] Create a new Idea project
+- [ ] Create a new Idea project with JDK 11
- [ ] Add a simple java file to test
- [ ] Generate tests for several classes
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index a9313c6e01..2590811bdd 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -10,6 +10,7 @@ Please delete options that are not relevant.
- Minor bug fix (non-breaking small changes)
- Bug fix (non-breaking change which fixes an issue)
+- Refactoring (typos and non-functional changes)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
@@ -27,10 +28,12 @@ Please, provide several scenarios that you went through to verify that the chang
# Checklist (remove irrelevant options):
+_This is the author self-check list_
+
- [ ] The change followed the style guidelines of the UTBot project
- [ ] Self-review of the code is passed
- [ ] The change contains enough commentaries, particularly in hard-to-understand areas
- [ ] New documentation is provided or existed one is altered
- [ ] No new warnings
-- [ ] Tests that prove my change is effective
+- [ ] New tests have been added
- [ ] All tests pass locally with my changes
diff --git a/.github/workflows/build-and-run-tests-from-branch.yml b/.github/workflows/build-and-run-tests-from-branch.yml
index e6e8798bac..c16a3bef2b 100644
--- a/.github/workflows/build-and-run-tests-from-branch.yml
+++ b/.github/workflows/build-and-run-tests-from-branch.yml
@@ -1,45 +1,205 @@
name: "[M] UTBot Java: build and run tests"
on:
- workflow_dispatch
-
+ workflow_dispatch:
+ inputs:
+ commit_sha:
+ required: false
+ type: string
+ description: "Commit SHA (optional -- otherwise the last commit from the branch will be taken)"
+
+ workflow_call:
+ inputs:
+ commit_sha:
+ required: false
+ type: string
+
+env:
+ REGISTRY: ghcr.io
+ IMAGE_NAME: utbot_java_cli
+ DOCKERFILE_PATH: docker/Dockerfile_java_cli
+ # Environment variable setting gradle options.
+ GRADLE_OPTS: "-XX:MaxHeapSize=2048m -Dorg.gradle.jvmargs='-XX:MaxHeapSize=2048m -XX:MaxPermSize=512m -Dorg.gradle.daemon=false' -Dorg.gradle.daemon=false"
+
jobs:
- build-and-run-tests:
+ prepare-matrices:
+ runs-on: ubuntu-latest
+ # Outputs are used for passing data to dependent jobs.
+ outputs:
+ framework-tests-matrix: ${{ steps.set-matrices.outputs.framework-tests-matrix }}
+ combined-projects-matrix: ${{ steps.set-matrices.outputs.combined-projects-matrix }}
+ steps:
+ - name: Print environment variables
+ run: printenv
+
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Check out ${{ github.event.inputs.commit_sha }} commit
+ if: github.event.inputs.commit_sha != ''
+ run: |
+ git config --global --add safe.directory ${GITHUB_WORKSPACE}
+ git fetch
+ git checkout ${{ github.event.inputs.commit_sha }}
+ - id: set-matrices
+ name: Read and print config from framework-tests-matrix.json and combined-projects-matrix.json
+ run: |
+ FRAMEWORK_TESTS=$(echo $(cat .github/workflows/framework-tests-matrix.json))
+ COMBINED_PROJECTS=$(echo $(cat .github/workflows/combined-projects-matrix.json))
+ echo "::set-output name=framework-tests-matrix::$FRAMEWORK_TESTS"
+ echo "::set-output name=combined-projects-matrix::$COMBINED_PROJECTS"
+ echo $FRAMEWORK_TESTS
+ echo $COMBINED_PROJECTS
+ framework-tests:
+ needs: prepare-matrices
+ # Using matrices let create multiple jobs runs based on the combinations of the variables from matrices.
+ # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
+ strategy:
+ # The option forces to execute all jobs even though some of them have failed.
+ fail-fast: false
+ matrix: ${{ fromJson(needs.prepare-matrices.outputs.framework-tests-matrix) }}
runs-on: ubuntu-20.04
+ container: unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v2
- with:
- java-version: '8'
- distribution: 'zulu'
- java-package: jdk+fx
- cache: gradle
- - uses: gradle/gradle-build-action@v2
- with:
- gradle-version: 6.8
-
- - name: Build and run tests in UTBot Java
+ - name: Print environment variables
+ run: printenv
+
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Check out ${{ github.event.inputs.commit_sha }} commit
+ if: github.event.inputs.commit_sha != ''
+ run: |
+ git config --global --add safe.directory ${GITHUB_WORKSPACE}
+ git fetch
+ git checkout ${{ github.event.inputs.commit_sha }}
+ - name: Run monitoring
+ run: |
+ echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
+ chmod +x ./scripts/project/monitoring.sh
+ ./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
+ - name: Run tests
+ run: |
+ gradle --no-daemon :utbot-framework-test:test ${{ matrix.project.TESTS_TO_RUN }}
+ - name: Upload logs
+ if: ${{ always() }}
+ uses: actions/upload-artifact@v3
+ with:
+ name: logs ${{ matrix.project.PART_NAME }}
+ path: utbot-framework-test/logs/*
+
+ - name: Upload UTBot temp directory content
+ if: ${{ always() }}
+ uses: actions/upload-artifact@v3
+ with:
+ name: utbot_temp ${{ matrix.project.PART_NAME }}
+ path: |
+ /tmp/UTBot/generated*/*
+ /tmp/UTBot/utbot-childprocess-errors/*
+ - name: Upload test report if tests have failed
+ if: ${{ failure() }}
+ uses: actions/upload-artifact@v3
+ with:
+ name: test_report ${{ matrix.project.PART_NAME }}
+ path: utbot-framework-test/build/reports/tests/test/*
+
+ combined-projects:
+ # This job does not need to wait for 'prepare-tests-matrix' result.
+ # GitHub allocates runners portionally. Framework tests are time consuming. That's why we want to force them
+ # to start execution early.
+ needs: prepare-matrices
+ # Using matrices let create multiple jobs runs based on the combinations of the variables from matrices.
+ # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
+ strategy:
+ # The option forces to execute all jobs even though some of them have failed.
+ fail-fast: false
+ matrix: ${{ fromJson(needs.prepare-matrices.outputs.combined-projects-matrix) }}
+ runs-on: ubuntu-20.04
+ container: unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0
+ steps:
+ - name: Print environment variables
+ run: printenv
+
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Check out ${{ github.event.inputs.commit_sha }} commit
+ if: github.event.inputs.commit_sha != ''
run: |
- export KOTLIN_HOME="/usr"
- gradle clean build --no-daemon
-
- - name: Upload utbot-framework logs
- if: ${{ always() }}
- uses: actions/upload-artifact@v2
- with:
- name: utbot_framework_logs
- path: utbot-framework/logs/*
-
- - name: Upload utbot-framework tests report artifacts if tests have failed
+ git config --global --add safe.directory ${GITHUB_WORKSPACE}
+ git fetch
+ git checkout ${{ github.event.inputs.commit_sha }}
+
+ - name: Run monitoring
+ run: |
+ echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
+ chmod +x ./scripts/project/monitoring.sh
+ ./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
+ - name: Build project ${{ matrix.projects.first }}
+ id: first-project
+ run: |
+ cd ${{ matrix.projects.first }}
+ gradle build --no-daemon
+ - name: Build project ${{ matrix.projects.second }}
+ if: ${{ steps.first-project.outcome != 'cancelled' && steps.first-project.outcome != 'skipped' }}
+ run: |
+ cd ${{ matrix.projects.second }}
+ gradle build --no-daemon
+ - name: Upload test report if tests have failed
if: ${{ failure() }}
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v3
with:
- name: utbot_framework_tests_report
- path: utbot-framework/build/reports/tests/test/*
-
- - name: Upload utbot-intellij tests report artifacts if tests have failed
+ name: test_report ${{ matrix.projects.first }}
+ path: ${{ matrix.projects.first }}/build/reports/tests/test/*
+
+ - name: Upload test report if tests have failed
if: ${{ failure() }}
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v3
with:
- name: utbot_intellij_tests_report
- path: utbot-intellij/build/reports/tests/test/*
+ name: test_report ${{ matrix.projects.second }}
+ path: ${{ matrix.projects.second }}/build/reports/tests/test/*
+
+
+ single-project:
+ # This job does not need to wait for 'prepare-tests-matrix' result.
+ # GitHub allocates runners portionally. Framework tests are time consuming. That's why we want to force them
+ # to start execution early.
+ needs: prepare-matrices
+ # Using matrices let create multiple jobs runs based on the combinations of the variables from matrices.
+ # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
+ strategy:
+ # The option forces to execute all jobs even though some of them have failed.
+ fail-fast: false
+ matrix:
+ project: [utbot-core, utbot-fuzzers, utbot-gradle, utbot-junit-contest, utbot-sample]
+ runs-on: ubuntu-20.04
+ container: unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0
+ steps:
+ - name: Print environment variables
+ run: printenv
+
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Check out ${{ github.event.inputs.commit_sha }} commit
+ if: github.event.inputs.commit_sha != ''
+ run: |
+ git config --global --add safe.directory ${GITHUB_WORKSPACE}
+ git fetch
+ git checkout ${{ github.event.inputs.commit_sha }}
+
+ - name: Run monitoring
+ run: |
+ echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
+ chmod +x ./scripts/project/monitoring.sh
+ ./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
+ - name: Run tests
+ run: |
+ cd ${{ matrix.project }}
+ gradle build --no-daemon
+ - name: Upload test report if tests have failed
+ if: ${{ failure() }}
+ uses: actions/upload-artifact@v3
+ with:
+ name: test_report ${{ matrix.project }}
+ path: ${{ matrix.project }}/build/reports/tests/test/*
diff --git a/.github/workflows/build-and-run-tests.yml b/.github/workflows/build-and-run-tests.yml
index 30af5f45ad..b3c62a1559 100644
--- a/.github/workflows/build-and-run-tests.yml
+++ b/.github/workflows/build-and-run-tests.yml
@@ -1,47 +1,92 @@
name: "UTBot Java: build and run tests"
-on:
+on:
push:
- branches: [main]
+ branches:
+ - 'main'
+ - 'unit-test-bot/r**'
pull_request:
- branches: [main]
+ branches:
+ - 'main'
+ - 'unit-test-bot/r**'
+
+env:
+ REGISTRY: ghcr.io
+ IMAGE_NAME: utbot_java_cli
+ DOCKERFILE_PATH: docker/Dockerfile_java_cli
+ # Environment variable setting gradle options.
+ GRADLE_OPTS: "-XX:MaxHeapSize=2048m -Dorg.gradle.jvmargs='-XX:MaxHeapSize=2048m -XX:MaxPermSize=512m -Dorg.gradle.daemon=false' -Dorg.gradle.daemon=false"
jobs:
- build_and_run_tests:
+ build-and-run-tests:
+ uses: ./.github/workflows/build-and-run-tests-from-branch.yml
+ secrets: inherit
+
+
+ publish-cli-image:
+ needs: build-and-run-tests
+ if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-20.04
+ container: unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v2
- with:
- java-version: '8'
- distribution: 'zulu'
- java-package: jdk+fx
- - uses: gradle/gradle-build-action@v2
- with:
- gradle-version: 6.8
-
- - name: Build and run tests in UTBot Java
+ - name: Print environment variables
+ run: printenv
+
+ - uses: actions/checkout@v3
+
+ - name: Set environment variables
run: |
- export KOTLIN_HOME="/usr"
- gradle clean build --no-daemon
+ # "You can make an environment variable available to any subsequent steps in a workflow job by
+ # defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
+ echo VERSION="$(date +%Y).$(date +%-m)" >> $GITHUB_ENV
- - name: Upload utbot-framework logs
- if: ${{ always() }}
- uses: actions/upload-artifact@v2
+ - name: Build UTBot Java CLI
+ run: |
+ cd utbot-cli
+ gradle build --no-daemon -x test -PsemVer=${{ env.VERSION }}
+ - name: Set docker tag
+ run:
+ # "You can make an environment variable available to any subsequent steps in a workflow job by
+ # defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
+ echo DOCKER_TAG="$(date +%Y).$(date +%-m).$(date +%-d)-${{ github.sha }}" >> $GITHUB_ENV
+
+ - name: Log in to the Container registry
+ uses: docker/login-action@v2
with:
- name: utbot_framework_logs
- path: utbot-framework/logs/*
-
- - name: Upload utbot-framework tests report artifacts if tests have failed
- if: ${{ failure() }}
- uses: actions/upload-artifact@v2
+ registry: ${{ env.REGISTRY }}
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v2
+
+ - name: Cache Docker layers
+ uses: actions/cache@v3
with:
- name: utbot_framework_tests_report
- path: utbot-framework/build/reports/tests/test/*
-
- - name: Upload utbot-intellij tests report artifacts if tests have failed
- if: ${{ failure() }}
- uses: actions/upload-artifact@v2
+ path: /tmp/.buildx-cache
+ key: ${{ runner.os }}-buildx-${{ github.sha }}
+ restore-keys: |
+ ${{ runner.os }}-buildx-
+ - name: Docker meta
+ id: meta
+ uses: docker/metadata-action@v3
with:
- name: utbot_intellij_tests_report
- path: utbot-intellij/build/reports/tests/test/*
+ images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }}
+ tags: |
+ type=raw,value=${{ env.DOCKER_TAG }}
+ - name: Docker Buildx (build and push)
+ run: |
+ docker buildx build \
+ -f ${{ env.DOCKERFILE_PATH }} \
+ --cache-from "type=local,src=/tmp/.buildx-cache" \
+ --cache-to "type=local,dest=/tmp/.buildx-cache-new" \
+ --tag ${{ steps.meta.outputs.tags }} \
+ --build-arg UTBOT_JAVA_CLI=utbot-cli/build/libs/utbot-cli-${{ env.VERSION }}.jar \
+ --push .
+ # Temp fix
+ # https://github.com/docker/build-push-action/issues/252
+ # https://github.com/moby/buildkit/issues/1896
+ - name: Move cache
+ run: |
+ rm -rf /tmp/.buildx-cache
+ mv /tmp/.buildx-cache-new /tmp/.buildx-cache
diff --git a/.github/workflows/collect-statistics.yml b/.github/workflows/collect-statistics.yml
new file mode 100644
index 0000000000..52696b4c9a
--- /dev/null
+++ b/.github/workflows/collect-statistics.yml
@@ -0,0 +1,223 @@
+name: "UTBot Java: collect statistics"
+
+on:
+ workflow_call:
+ inputs:
+ runners:
+ description: 'Runners number'
+ required: false
+ default: '1'
+ type: string
+ run_number:
+ description: 'Number of run tries per runner'
+ required: false
+ default: '1'
+ type: string
+ message_prefix:
+ description: 'Commit message prefix'
+ required: false
+ default: manual-run
+ type: string
+ aggregate:
+ description: 'Aggregate data'
+ required: false
+ default: false
+ type: boolean
+
+ workflow_dispatch:
+ inputs:
+ runners:
+ description: 'Runners number'
+ required: false
+ default: '1'
+ type: string
+ run_number:
+ description: 'Number of run tries per runner'
+ required: false
+ default: '1'
+ type: string
+ message_prefix:
+ description: 'Commit message prefix'
+ required: false
+ default: manual-run
+ type: string
+ aggregate:
+ description: 'Aggregate data'
+ required: false
+ default: false
+ type: boolean
+
+env:
+ data_branch: monitoring-data
+ data_path: monitoring/data
+ aggregated_data_branch: monitoring-aggregated-data
+ aggregated_data_path: monitoring/aggregated_data
+ monitoring_properties: monitoring/monitoring.properties
+ push_script: monitoring/push_with_rebase.sh
+
+jobs:
+ setup_matrix:
+ runs-on: ubuntu-latest
+ outputs:
+ matrix: ${{ steps.set-matrix.outputs.matrix }}
+ steps:
+ - name: Create matrix
+ id: set-matrix
+ run: |
+ arr=$(echo [$(seq -s , ${{ inputs.runners }})])
+ echo "::set-output name=matrix::$arr"
+ echo $arr
+
+ build_and_collect_statistics:
+ needs: setup_matrix
+ continue-on-error: true
+ strategy:
+ matrix:
+ value: ${{ fromJson(needs.setup_matrix.outputs.matrix) }}
+ runs-on: ubuntu-20.04
+ container: unittestbot/java-env:java11-zulu-jdk-fx-gradle7.4.2-kotlinc1.7.0
+ steps:
+ - name: Install git
+ run: |
+ apt-get upgrade -y
+ apt-get update -y
+ apt-get install git -y
+ git config --global --add safe.directory $(pwd)
+
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Checkout monitoring data
+ uses: actions/checkout@v3
+ with:
+ ref: ${{ env.data_branch }}
+ path: ${{ env.data_path }}
+
+ - uses: actions/setup-python@v4
+ with:
+ python-version: '3.9'
+
+ - name: Build and run monitoring UTBot Java
+ run: |
+ gradle :utbot-junit-contest:monitoringJar
+ for i in $(seq ${{ inputs.run_number }})
+ do
+ java -jar \
+ -Dutbot.monitoring.settings.path=$monitoring_properties \
+ utbot-junit-contest/build/libs/monitoring.jar \
+ stats-$i.json
+ mv logs/utbot.log logs/utbot-$i.log
+ done
+
+ - name: Get current date
+ id: date
+ run: |
+ echo "::set-output name=date::$(date +'%Y-%m-%d')"
+ echo "::set-output name=timestamp::$(date +%s)"
+ echo "::set-output name=last_month::$(date --date='last month' +%s)"
+
+ - name: Get metadata
+ id: metadata
+ run: |
+ echo "::set-output name=commit::$(git rev-parse HEAD)"
+ echo "::set-output name=short_commit::$(git rev-parse --short HEAD)"
+ echo "::set-output name=branch::$(git name-rev --name-only HEAD)"
+ echo "::set-output name=build::$(date +'%Y.%-m')"
+
+ - name: Insert metadata
+ shell: bash
+ run: |
+ OUT_FILE="$data_path/data-$branch-$date-$timestamp-$short_commit-${{ matrix.value }}.json"
+ INPUTS=($(seq ${{ inputs.run_number }}))
+ INPUTS=(${INPUTS[@]/#/stats-})
+ INPUTS=(${INPUTS[@]/%/.json})
+ INPUTS=${INPUTS[@]}
+ echo $INPUTS
+ python monitoring/insert_metadata.py \
+ --stats_file $INPUTS \
+ --output_file "$OUT_FILE" \
+ --commit $commit \
+ --branch $branch \
+ --build "$build" \
+ --timestamp $timestamp \
+ --source_type "github-action" \
+ --source_id $run_id
+ env:
+ date: ${{ steps.date.outputs.date }}
+ timestamp: ${{ steps.date.outputs.timestamp }}
+ commit: ${{ steps.metadata.outputs.commit }}
+ short_commit: ${{ steps.metadata.outputs.short_commit }}
+ branch: ${{ steps.metadata.outputs.branch }}
+ build: ${{ steps.metadata.outputs.build }}
+ run_id: ${{ github.run_id }}-${{ matrix.value }}
+
+ - name: Commit and push statistics
+ run: |
+ chmod +x $push_script
+ ./$push_script
+ env:
+ target_branch: ${{ env.data_branch }}
+ target_directory: ${{ env.data_path }}
+ message: ${{ inputs.message_prefix }}-${{ steps.date.outputs.date }}
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Upload logs
+ if: ${{ always() }}
+ uses: actions/upload-artifact@v3
+ with:
+ name: logs-${{ matrix.value }}
+ path: logs/
+
+ aggregate:
+ needs: build_and_collect_statistics
+ if: ${{ inputs.aggregate }}
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Checkout monitoring data
+ uses: actions/checkout@v3
+ with:
+ ref: ${{ env.data_branch }}
+ path: ${{ env.data_path }}
+
+ - name: Checkout aggregated monitoring data
+ uses: actions/checkout@v3
+ with:
+ ref: ${{ env.aggregated_data_branch }}
+ path: ${{ env.aggregated_data_path }}
+
+ - uses: actions/setup-python@v4
+ with:
+ python-version: '3.9'
+
+ - name: Get current date
+ id: date
+ run: |
+ echo "::set-output name=date::$(date +'%Y-%m-%d')"
+ echo "::set-output name=timestamp::$(date +%s)"
+ echo "::set-output name=last_month::$(date --date='last month' +%s)"
+
+ - name: Build aggregated data (last month)
+ run: |
+ OUT_FILE=$aggregated_data_path/aggregated-data-$date.json
+ python monitoring/build_aggregated_data.py \
+ --input_data_dir $data_path \
+ --output_file $OUT_FILE \
+ --timestamp_from $timestamp_from \
+ --timestamp_to $timestamp
+ env:
+ date: ${{ steps.date.outputs.date }}
+ timestamp: ${{ steps.date.outputs.timestamp }}
+ timestamp_from: ${{ steps.date.outputs.last_month }}
+
+ - name: Commit and push aggregated statistics
+ run: |
+ chmod +x $push_script
+ ./$push_script
+ env:
+ target_branch: ${{ env.aggregated_data_branch }}
+ target_directory: ${{ env.aggregated_data_path }}
+ message: ${{ inputs.message_prefix }}-${{ steps.date.outputs.date }}
+ github_token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/combined-projects-matrix.json b/.github/workflows/combined-projects-matrix.json
new file mode 100644
index 0000000000..823e0a2624
--- /dev/null
+++ b/.github/workflows/combined-projects-matrix.json
@@ -0,0 +1,20 @@
+{
+ "projects": [
+ {
+ "FIRST": "utbot-intellij",
+ "SECOND": "utbot-cli",
+ },
+ {
+ "FIRST": "utbot-instrumentation",
+ "SECOND": "utbot-instrumentation-tests",
+ },
+ {
+ "FIRST": "utbot-summary",
+ "SECOND": "utbot-summary-tests",
+ },
+ {
+ "FIRST": "utbot-api",
+ "SECOND": "utbot-framework-api",
+ }
+ ]
+}
diff --git a/.github/workflows/framework-tests-matrix.json b/.github/workflows/framework-tests-matrix.json
new file mode 100644
index 0000000000..f843cfddca
--- /dev/null
+++ b/.github/workflows/framework-tests-matrix.json
@@ -0,0 +1,44 @@
+{
+ "project": [
+ {
+ "PART_NAME": "composite",
+ "TESTS_TO_RUN": "--tests \"org.utbot.examples.manual.*\" --tests \"org.utbot.examples.stream.*\" --tests \"org.utbot.engine.*\" --tests \"org.utbot.framework.*\" --tests \"org.utbot.sarif.*\"",
+ },
+ {
+ "PART_NAME": "collections-part1",
+ "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.CustomerExamplesTest\" --tests \"org.utbot.examples.collections.GenericListsExampleTest\" --tests \"org.utbot.examples.collections.LinkedListsTest\" --tests \"org.utbot.examples.collections.ListAlgorithmsTest\" --tests \"org.utbot.examples.collections.ListIteratorsTest\" --tests \"org.utbot.examples.collections.ListWrapperReturnsVoidTest\" --tests \"org.utbot.examples.collections.MapEntrySetTest\" --tests \"org.utbot.examples.collections.MapKeySetTest\"",
+ },
+ {
+ "PART_NAME": "collections-part2",
+ "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.MapValuesTest\" --tests \"org.utbot.examples.collections.OptionalsTest\" --tests \"org.utbot.examples.collections.SetIteratorsTest\"",
+ },
+ {
+ "PART_NAME": "collections-part3",
+ "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.SetsTest\"",
+ },
+ {
+ "PART_NAME": "examples-part1",
+ "TESTS_TO_RUN": "--tests \"org.utbot.examples.algorithms.*\" --tests \"org.utbot.examples.annotations.*\" --tests \"org.utbot.examples.arrays.*\" --tests \"org.utbot.examples.casts.*\" --tests \"org.utbot.examples.codegen.*\" --tests \"org.utbot.examples.controlflow.*\" --tests \"org.utbot.examples.enums.*\"",
+ },
+ {
+ "PART_NAME": "examples-part2",
+ "TESTS_TO_RUN": "--tests \"org.utbot.examples.exceptions.*\" --tests \"org.utbot.examples.invokes.*\" --tests \"org.utbot.examples.lambda.*\" --tests \"org.utbot.examples.make.symbolic.*\" --tests \"org.utbot.examples.math.*\" --tests \"org.utbot.examples.mixed.*\" --tests \"org.utbot.examples.mock.*\" --tests \"org.utbot.examples.models.*\" --tests \"org.utbot.examples.natives.*\" --tests \"org.utbot.examples.objects.*\"",
+ },
+ {
+ "PART_NAME": "examples-part3",
+ "TESTS_TO_RUN": "--tests \"org.utbot.examples.primitives.*\" --tests \"org.utbot.examples.recursion.*\" --tests \"org.utbot.examples.statics.substitution.*\" --tests \"org.utbot.examples.stdlib.*\" --tests \"org.utbot.examples.strings.*\" --tests \"org.utbot.examples.structures.*\" --tests \"org.utbot.examples.thirdparty.numbers.*\" --tests \"org.utbot.examples.types.*\" --tests \"org.utbot.examples.unsafe.*\" --tests \"org.utbot.examples.wrappers.*\"",
+ },
+ {
+ "PART_NAME": "examples-lists",
+ "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.ListsPart1Test\" --tests \"org.utbot.examples.collections.ListsPart2Test\" --tests \"org.utbot.examples.collections.ListsPart3Test\"",
+ },
+ {
+ "PART_NAME": "examples-maps-part1",
+ "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.MapsPart1Test\"",
+ },
+ {
+ "PART_NAME": "examples-maps-part2",
+ "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.MapsPart2Test\"",
+ }
+ ]
+}
diff --git a/.github/workflows/night-statistics-monitoring.yml b/.github/workflows/night-statistics-monitoring.yml
new file mode 100644
index 0000000000..c7cda2307b
--- /dev/null
+++ b/.github/workflows/night-statistics-monitoring.yml
@@ -0,0 +1,15 @@
+name: "UTBot Java: night statistics monitoring"
+
+on:
+ schedule:
+ - cron: '0 0 * * *'
+
+jobs:
+ run_monitoring:
+ uses: ./.github/workflows/collect-statistics.yml
+ secrets: inherit
+ with:
+ runners: 3
+ run_number: 1
+ message_prefix: night-monitoring
+ aggregate: true
diff --git a/.github/workflows/publish-cli-image.yml b/.github/workflows/publish-cli-image.yml
deleted file mode 100644
index fbc98c35a9..0000000000
--- a/.github/workflows/publish-cli-image.yml
+++ /dev/null
@@ -1,73 +0,0 @@
-name: "CLI: publish image"
-on:
- push:
- branches: [main]
-
-env:
- REGISTRY: ghcr.io
- IMAGE_NAME: utbot_java_cli
- DOCKERFILE_PATH: docker/Dockerfile_java_cli
-
-jobs:
- build-and-publish-docker:
- runs-on: ubuntu-20.04
- steps:
- - name: Checkout repository
- uses: actions/checkout@v3
-
- - name: Set timezone
- uses: szenius/set-timezone@v1.0
- with:
- timezoneLinux: "Europe/Moscow"
-
- - name: Set environment variables
- run:
- echo "COMMIT_SHORT_SHA="$(git rev-parse --short HEAD)"" >> $GITHUB_ENV
-
- - name: Set docker tag
- run:
- echo "DOCKER_TAG="$(date +%Y).$(date +%-m).$(date +%-d)-${{ env.COMMIT_SHORT_SHA }}"" >> $GITHUB_ENV
-
- - name: Log in to the Container registry
- uses: docker/login-action@v1
- with:
- registry: ${{ env.REGISTRY }}
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
-
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v1
-
- - name: Cache Docker layers
- uses: actions/cache@v2
- with:
- path: /tmp/.buildx-cache
- key: ${{ runner.os }}-buildx-${{ github.sha }}
- restore-keys: |
- ${{ runner.os }}-buildx-
-
- - name: Docker meta
- id: meta
- uses: docker/metadata-action@v3
- with:
- images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }}
- tags: |
- type=raw,value=${{ env.DOCKER_TAG }}
-
- - name: Docker Buildx (build and push)
- run: |
- docker buildx build \
- -f ${{ env.DOCKERFILE_PATH }} \
- --cache-from "type=local,src=/tmp/.buildx-cache" \
- --cache-to "type=local,dest=/tmp/.buildx-cache-new" \
- --tag ${{ steps.meta.outputs.tags }} \
- --build-arg ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }} \
- --push .
-
- # Temp fix
- # https://github.com/docker/build-push-action/issues/252
- # https://github.com/moby/buildkit/issues/1896
- - name: Move cache
- run: |
- rm -rf /tmp/.buildx-cache
- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
diff --git a/.github/workflows/publish-on-github-packages.yml b/.github/workflows/publish-on-github-packages.yml
index 9fb1e3e2cf..69fd73e0bc 100644
--- a/.github/workflows/publish-on-github-packages.yml
+++ b/.github/workflows/publish-on-github-packages.yml
@@ -3,58 +3,43 @@ name: "[M] Publish on GitHub Packages"
on:
workflow_dispatch:
inputs:
- commit-sha:
+ commit_sha:
type: string
required: true
description: "commit SHA: e.g. cab4799c"
+
+env:
+ # Environment variable setting gradle options.
+ GRADLE_OPTS: "-XX:MaxHeapSize=2048m -Dorg.gradle.jvmargs='-XX:MaxHeapSize=2048m -XX:MaxPermSize=512m -Dorg.gradle.daemon=false' -Dorg.gradle.daemon=false"
jobs:
+ build-and-run-tests:
+ if: ${{ github.actor == 'korifey' || github.actor == 'denis-fokin' || github.actor == 'victoriafomina' || github.actor == 'bissquit' }}
+ uses: ./.github/workflows/build-and-run-tests-from-branch.yml
+ with:
+ commit_sha: ${{ github.event.inputs.commit_sha }}
+ secrets: inherit
+
publish_on_github_packages:
- if: ${{ github.actor == 'korifey' || github.actor == 'denis-fokin' || github.actor == 'victoriafomina' ||
- github.actor == 'bissquit' }}
+ needs: build-and-run-tests
runs-on: ubuntu-20.04
- permissions:
- packages: write
- contents: read
steps:
- - uses: actions/checkout@v3
- - uses: actions/setup-java@v3
- with:
- java-version: '8'
- distribution: 'zulu'
- java-package: jdk+fx
- cache: gradle
- - uses: gradle/gradle-build-action@v2
- with:
- gradle-version: 6.8
-
- - name: Check out ${{ github.event.inputs.commit-sha }} commit
+ - name: Print environment variables
+ run: printenv
+
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Check out ${{ github.event.inputs.commit_sha }} commit
+ if: github.event.inputs.commit_sha != ''
run: |
+ git config --global --add safe.directory ${GITHUB_WORKSPACE}
git fetch
- git checkout ${{ github.event.inputs.commit-sha }}
-
- - name: "UTBot Java: build and run tests"
- run: |
- export KOTLIN_HOME="/usr"
- gradle clean build --no-daemon
-
- - name: Upload utbot-framework logs
- if: ${{ failure() }}
- uses: actions/upload-artifact@v2
- with:
- name: utbot_framework_logs
- path: utbot-framework/logs/*
-
- - name: Upload utbot-framework tests report artifacts if tests have failed
- if: ${{ failure() }}
- uses: actions/upload-artifact@v2
- with:
- name: utbot_framework_tests_report
- path: utbot-framework/build/reports/tests/test/*
-
+ git checkout ${{ github.event.inputs.commit_sha }}
+
- uses: gradle/gradle-build-action@v2
with:
- gradle-version: 6.8
+ gradle-version: 7.4.2
arguments: publish
env:
GITHUB_ACTOR: ${{ github.actor }}
diff --git a/.github/workflows/publish-plugin-and-cli-from-branch.yml b/.github/workflows/publish-plugin-and-cli-from-branch.yml
index af6006cb32..e9bdb161d6 100644
--- a/.github/workflows/publish-plugin-and-cli-from-branch.yml
+++ b/.github/workflows/publish-plugin-and-cli-from-branch.yml
@@ -1,6 +1,14 @@
name: "[M] Plugin and CLI: publish as archives"
on:
+ workflow_call:
+ inputs:
+ version-postfix:
+ type: string
+ description: "It adds postfix (alpha or beta) to version (optional)."
+ required: false
+ default: no-postfix
+
workflow_dispatch:
inputs:
version-postfix:
@@ -10,58 +18,62 @@ on:
default: no-postfix
options:
- no-postfix
+ - no-postfix-prod
- alpha
- beta
-
+
+env:
+ # Environment variable setting gradle options.
+ GRADLE_OPTS: "-XX:MaxHeapSize=2048m -Dorg.gradle.jvmargs='-XX:MaxHeapSize=2048m -XX:MaxPermSize=512m -Dorg.gradle.daemon=false' -Dorg.gradle.daemon=false"
+
jobs:
publish_plugin_and_cli:
runs-on: ubuntu-20.04
+ container: unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v2
- with:
- java-version: '8'
- distribution: 'zulu'
- java-package: jdk+fx
- cache: gradle
- - uses: gradle/gradle-build-action@v2
- with:
- gradle-version: 6.8
-
+ - name: Print environment variables
+ run: printenv
+
+ - uses: actions/checkout@v3
+
- name: Set environment variables
run: |
- echo "VERSION="$(date +%Y).$(date +%-m)"" >> $GITHUB_ENV
+ # "You can make an environment variable available to any subsequent steps in a workflow job by
+ # defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
+ echo "VERSION="$(date +%Y).$(date +%-m).${GITHUB_RUN_NUMBER}"" >> $GITHUB_ENV
echo "POSTFIX=${{ github.event.inputs.version-postfix }}" >> $GITHUB_ENV
-
+
+ - name: Set production version
+ if: ${{ github.event.inputs.version-postfix == 'no-postfix-prod' || github.event.inputs.version-postfix == 'alpha' || github.event.inputs.version-postfix == 'beta' }}
+ run: |
+ echo "VERSION="$(date +%Y).$(date +%-m)"" >> $GITHUB_ENV
+
- name: Create version with postfix
if: ${{ (env.POSTFIX == 'alpha') || (env.POSTFIX == 'beta') }}
run:
echo "VERSION=${{ env.VERSION }}-${{ env.POSTFIX }}" >> $GITHUB_ENV
-
+
- name: Build UTBot IntelliJ IDEA plugin
run: |
- export KOTLIN_HOME="/usr"
- gradle buildPlugin --no-daemon -PsemVer=${{ env.VERSION }}
+ gradle clean buildPlugin --no-daemon -PsemVer=${{ env.VERSION }}
cd utbot-intellij/build/distributions
unzip utbot-intellij-${{ env.VERSION }}.zip
rm utbot-intellij-${{ env.VERSION }}.zip
-
+
- name: Archive UTBot IntelliJ IDEA plugin
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v3
with:
name: utbot-intellij-${{ env.VERSION }}
path: utbot-intellij/build/distributions/*
-
+
- name: Build UTBot CLI
run: |
- export KOTLIN_HOME="/usr"
cd utbot-cli
gradle clean build --no-daemon -PsemVer=${{ env.VERSION }}
- cd build/libs
- name: Archive UTBot CLI
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v3
with:
name: utbot-cli-${{ env.VERSION }}
path: utbot-cli/build/libs/utbot-cli-${{ env.VERSION }}.jar
diff --git a/.github/workflows/publish-plugin-and-cli.yml b/.github/workflows/publish-plugin-and-cli.yml
index 5629063d3f..0b1ea41ad7 100644
--- a/.github/workflows/publish-plugin-and-cli.yml
+++ b/.github/workflows/publish-plugin-and-cli.yml
@@ -1,50 +1,11 @@
name: "Plugin and CLI: publish as archives"
on:
push:
- branches: [main]
-
+ branches:
+ - 'main'
+ - 'unit-test-bot/r**'
+
jobs:
publish_plugin_and_cli:
- runs-on: ubuntu-20.04
-
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v2
- with:
- java-version: '8'
- distribution: 'zulu'
- java-package: jdk+fx
- - uses: gradle/gradle-build-action@v2
- with:
- gradle-version: 6.8
-
- - name: Set environment variables
- run:
- echo "VERSION="$(date +%Y).$(date +%-m)"" >> $GITHUB_ENV
-
- - name: Build UTBot IntelliJ IDEA plugin
- run: |
- export KOTLIN_HOME="/usr"
- gradle buildPlugin --no-daemon -PsemVer=${{ env.VERSION }}
- cd utbot-intellij/build/distributions
- unzip utbot-intellij-${{ env.VERSION }}.zip
- rm utbot-intellij-${{ env.VERSION }}.zip
-
- - name: Archive UTBot IntelliJ IDEA plugin
- uses: actions/upload-artifact@v2
- with:
- name: utbot-intellij-${{ env.VERSION }}
- path: utbot-intellij/build/distributions/*
-
- - name: Build UTBot CLI
- run: |
- export KOTLIN_HOME="/usr"
- cd utbot-cli
- gradle clean build --no-daemon -PsemVer=${{ env.VERSION }}
- cd build/libs
-
- - name: Archive UTBot CLI
- uses: actions/upload-artifact@v2
- with:
- name: utbot-cli-${{ env.VERSION }}
- path: utbot-cli/build/libs/utbot-cli-${{ env.VERSION }}.jar
+ uses: ./.github/workflows/publish-plugin-and-cli-from-branch.yml
+ secrets: inherit
diff --git a/.github/workflows/run-chosen-tests-from-branch.yml b/.github/workflows/run-chosen-tests-from-branch.yml
index 968a2982fe..e419ea0e0f 100644
--- a/.github/workflows/run-chosen-tests-from-branch.yml
+++ b/.github/workflows/run-chosen-tests-from-branch.yml
@@ -1,4 +1,3 @@
-
name: "[M] Run chosen tests"
on:
@@ -12,6 +11,7 @@ on:
options:
- utbot-analytics
- utbot-cli
+ - utbot-core
- utbot-framework-api
- utbot-framework
- utbot-fuzzers
@@ -19,42 +19,57 @@ on:
- utbot-instrumentation-tests
- utbot-instrumentation
- utbot-intellij
+ - utbot-sample
+ - utbot-summary
+ - utbot-summary-tests
tests-bunch-name:
type: string
required: true
- description: "{package-name}.{class-name}.{test-name-optional}"
-
+ description: "{package-name}.{class-name-optional}.{test-name-optional}"
+
+env:
+ # Environment variable setting gradle options.
+ GRADLE_OPTS: "-XX:MaxHeapSize=2048m -Dorg.gradle.jvmargs='-XX:MaxHeapSize=2048m -XX:MaxPermSize=512m -Dorg.gradle.daemon=false' -Dorg.gradle.daemon=false"
+
jobs:
run-chosen-tests:
runs-on: ubuntu-20.04
-
+ container: unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0
+
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v2
- with:
- java-version: '8'
- distribution: 'zulu'
- java-package: jdk+fx
- cache: gradle
- - uses: gradle/gradle-build-action@v2
- with:
- gradle-version: 6.8
+ - name: Print environment variables
+ run: printenv
+
+ - uses: actions/checkout@v3
+
+ - name: Run monitoring
+ run: |
+ echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
+ chmod +x ./scripts/project/monitoring.sh
+ ./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
- name: Run chosen tests
run: |
- export KOTLIN_HOME="/usr"
- gradle :${{ github.event.inputs.project-name }}:test --tests ${{ github.event.inputs.tests-bunch-name }}
+ gradle :${{ github.event.inputs.project-name }}:test --no-daemon --tests ${{ github.event.inputs.tests-bunch-name }}
- name: Upload ${{ github.event.inputs.project-name }} tests report if tests have failed
if: ${{ failure() }}
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v3
with:
name: ${{ github.event.inputs.project-name }}-tests-report
path: ${{ github.event.inputs.project-name }}/build/reports/tests/test/*
- - name: Upload utbot-framework logs if utbot-framework tests have failed
- if: ${{ failure() || (github.event.inputs.project-name == 'utbot-framework') }}
- uses: actions/upload-artifact@v2
+ - name: Upload generated tests
+ if: ${{ always() && github.event.inputs.project-name == 'utbot-framework' }}
+ uses: actions/upload-artifact@v3
+ with:
+ name: generated-tests
+ path: |
+ /tmp/UTBot/generated*/*
+ /tmp/UTBot/utbot-childprocess-errors/*
+ - name: Upload utbot-framework logs
+ if: ${{ always() && github.event.inputs.project-name == 'utbot-framework' }}
+ uses: actions/upload-artifact@v3
with:
- name: utbot_framework_logs
+ name: utbot-framework-logs
path: utbot-framework/logs/*
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 2a95592c8f..f60e4a0eb0 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,36 +1,117 @@
-# How to contribute to UTBot Java
+# UnitTestBot contributing guide
-To begin with, we are very thankful for your time and willingness to read this and contribute!
+---
-The following guideline should help you with suggesting changes to our project, so feel free to use it for your contribution. π
+## Welcome!
+Hello and thanks for reading this!
-## I\`ve found a bug! How to report?
+As the UnitTestBot core team we develop tools for automated unit test generation to help programmers test their code
+in a more effective way with less effort. We believe that software development is great fun when you spend your time
+finding creative solutions and automate the things you already know. If you are curious about making test generation
+fast, smart and reliable, we are happy to invite you for contributing!
-First of all, please check our [Issues](https://github.com/UnitTestBot/UTBotJava/issues) β this bug may have already been reported, and you just don\`t need to spend your time on a new one.
+We welcome absolutely everyone. With one big and kind request: please follow these guidelines to make our communication smooth and to keep UnitTestBot improving.
-If you haven\`t found the relevant issue, don\`t hesitate to [create a new one](https://github.com/UnitTestBot/UTBotJava/issues/new?assignees=&labels=&template=bug_report.md&title=), including as much detail as possible β the pre-made template will assist you in it.
+## Contributions we are looking for
-In case you already have a PR with a solution, please remain so amazing and link it with the created issue.
+There are so many ways to contribute. Choose yours and find the relevant short guide below.
+|(1) Choose what you like and check the guideline:| (2) Contribute: |
+|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
+|Reporting a bug| Create a [bug reporting issue](https://github.com/UnitTestBot/UTBotJava/issues/new?assignees=&labels=&template=bug_report.md&title=) |
+|Suggesting a feature| Create a [feature suggestion issue](https://github.com/UnitTestBot/UTBotJava/issues/new?assignees=&labels=&template=feature_request.md&title=) |
+|Contributing the code (bug fix or feature implementation)| Create a pull request |
+|Reproducing a reported bug| Comment on the issue |
+|Testing a pull request| Comment on the pull request |
+|Improving documentation| Create an issue
Create a pull request
Comment on issues and PRs |
+|Sharing ideas| Start the [Discussion](https://github.com/UnitTestBot/UTBotJava/discussions) or join the existing one |
-## I have an improvement suggestion!
-Want a new feature or to change the existing one? We are very welcome your fresh ideas. π
+# How to submit a contribution
-Please [create an issue](https://github.com/UnitTestBot/UTBotJava/issues/new?assignees=&labels=&template=feature_request.md&title=) with your proposal and describe your idea with full information about it. By adding some examples you also bring much happiness to our souls!
+## Reporting a bug
-Give us some time to review your proposal and provide you with our feedback. It will be decided who is preparing the pull request: we may need your help or we will take care of it all. π
+1. Check if the bug (a true bug!) has already been reported: search through [UnitTestBot issues](https://github.com/UnitTestBot/UTBotJava/issues). Please, don't duplicate.
+2. Check with the [Naming and labeling conventions](Conventions.md).
+3. Make sure you have all the necessary information as per [template](https://github.com/UnitTestBot/UTBotJava/issues/new?assignees=&labels=&template=bug_report.md&title=) and create the bug reporting issue.
+## Requesting a feature
-## Coding conventions
-Our team adheres to the defined requirements to coding style to optimize for readability. You can take a look on this [Coding style guide](https://github.com/saveourtool/diktat/blob/master/info/guide/diktat-coding-convention.md) to better understand what we expect to see in your code.
+1. Check if the feature has already been requested: search through [UnitTestBot issues](https://github.com/UnitTestBot/UTBotJava/issues).
+2. Check with our [Naming and labeling conventions](Conventions.md).
+3. Make sure you are able to provide all the necessary information as per [template](https://github.com/UnitTestBot/UTBotJava/issues/new?assignees=&labels=&template=feature_request.md&title=) and create the feature request issue.
+## Contributing the code (bug fix or feature implementation)
-## How to setup development environment?
+### "Good first issue"
-Please refer [Developer guide](https://github.com/UnitTestBot/UTBotJava/blob/main/DEVNOTE.md) to setup developer environment, build and run UTBot.
+If you have little experience in contributing, try to resolve the issues labeled as the ["good first"](https://github.com/UnitTestBot/UTBotJava/contribute) ones.
+### Small or "obvious" fixes
-## How to test you PR?
+Do you need to create an issue if you want to fix a bug?
-Currently, not all checks are automized. It's required to do manual testing after PR.
+* Quick fix β no issue β pull request.
+* Takes time to fix β detailed issue β pull request.
+
+### General flow for contributing code
+
+1. Make sure you've carefully read the [Legal notes](#Legal-notes)!
+2. Create your own fork of the code.
+3. Clone the forked repository to your local machine.
+4. Implement changes. Please refer to the [Developer guide](DEVNOTE.md) for **system requirements**, **code
+ style** and
+ **steps for building the project**.
+5. Test your code:
+ * Before creating the pull request perform the tests you find necessary for your code changes.
+ * When implementing something new, it's great to find real users and ask them to try out your feature β to prove
+ the necessity and quality of your suggestion.
+6. Check with the [Naming and labeling conventions](Conventions.md).
+7. Create the pull request, and you'll see if the automated tests pass on GitHub. Your reviewer will possibly recommend
+ you more tests.
+
+## Reproducing a reported bug
+
+If you reproduce an existing issue and it helps to get some additional context on the problem, feel free to comment on the issue.
+
+## Testing a pull request
+
+You can merge a pull request into your local copy of the project and test the changes. If you find something you'd like to share, add the outcome of your testing in a comment on the pull request.
+
+## Improving documentation
+
+Here at UnitTestBot we regard documentation as code. It means that the general flow for writing and reviewing docs
+is the same as for the code. If you'd like to improve the existing docs or to add something new, please follow the flow:
+
+1. Make sure you've carefully read the [Legal notes](#Legal-notes)!
+2. Create your own fork of the code.
+3. Clone the forked repository to your local machine.
+4. Implement changes to docs (change the existing doc or create a new one). Usually, we create a new doc for a new feature, not for the small fixes. You are not obliged to write a detailed text about the feature you implement. You have to only describe it properly in both the related issue and the pull request, but it will be great if you still provide some docs.
+6. Check with the [Naming and labeling conventions](Conventions.md).
+7. Create the pull request, and we'll review it.
+
+* You can request a new doc β create an issue, using the [guide for a feature request](#Requesting-a-feature).
+* You can comment on the docs-related issues or PRs.
+
+## Sharing ideas
+
+We have a lot of new ideas, but we always need more!
+
+These are our main areas of interest:
+
+* technologies for code analysis, generating unit tests, e. g. symbolic execution, fuzzing, machine learning, etc.;
+* real-life examples of using UnitTestBot, as well as possible use cases, scenarios and user stories;
+* practices and problems or UX research related to unit testing with or without automated test generation tools.
+
+If you are keen on these things too, please share your ideas with us. Even if they are sketchy and not ready for being implemented or even requested right now, go ahead and join the existing [Discussions](https://github.com/UnitTestBot/UTBotJava/discussions) or [start](https://github.com/UnitTestBot/UTBotJava/discussions/new) the new one.
+
+# Code review process
+Please choose [denis-fokin](https://github.com/denis-fokin) as a reviewer. He will reassign your PR to someone else from the core team, if necessary.
+
+We do our best in reviewing, but we can hardly specify the exact timeout for it. Be sure that we'll certainly answer your pull request!
+
+# Legal notes
+
+By contributing, you agree that your contributions will be licensed under the [Apache License 2.0](https://github.com/UnitTestBot/UTBotJava/blob/main/LICENSE).
+
+Feel free to [contact us directly](https://www.utbot.org/contact/) if that's a concern.
\ No newline at end of file
diff --git a/Conventions.md b/Conventions.md
new file mode 100644
index 0000000000..306f3c1749
--- /dev/null
+++ b/Conventions.md
@@ -0,0 +1,44 @@
+# Naming and labeling conventions
+
+---
+
+## Naming conventions
+
+### How to name a branch
+
+We use feature branches for development. Our best practice is to use the "my-github-username" prefix for each branch and to split words with the low line, e.g.:
+
+**_githubuser/my_feature_branch_**
+
+### How to name issues, commits and pull requests
+
+We have been using GitHub for a while, and now we have a couple of tips for naming issues, commits and pull requests (
+PRs). You are welcome to stick to them too π
+
+Our favorite recipes are:
+
+**issue title = feature request or bug description + issue ID**
+
+**commit message = PR title = fix description + issue ID + (PR number)**
+
+How to insert the issue ID into the commit message and the PR title?
+β Manually.
+
+How to append the PR number to the PR title?
+β It appends automatically.
+
+How to insert the PR number into the commit message?
+β *Push* the feature branch + *Create pull request* on GitHub and then β
+
+1) The preferred and the easiest flow:
+
*Squash and merge* on GitHub β the PR number automatically appends to the resulting commit message
+2) The flow for advanced users:
+
(a) squash the commits locally β insert the PR number in parentheses (!) manually into the resulting commit
+ message + *Force Push* the resulting commit β *Rebase and merge* on GitHub
+
or
+
(b) change the commit message locally β insert the PR number in parentheses (!) manually + *Force Push* the
+ commit β *Rebase and merge* on GitHub
+
+## Labeling conventions
+
+To choose the proper labels for your issue or PR, refer to the [Label usage guidelines](https://github.com/UnitTestBot/UTBotJava/wiki/Labels-usage-guidelines).
\ No newline at end of file
diff --git a/DEVNOTE.md b/DEVNOTE.md
index 3fe8ffb9da..a509f5901c 100644
--- a/DEVNOTE.md
+++ b/DEVNOTE.md
@@ -1,49 +1,24 @@
-# UTBot Java Developer Guide
-
- Here are the steps for you to jump into UTBot Java.
-
-## Install UTBot Java from source
-1. Clone UTBot Java repository via [Git](https://github.com/UnitTestBot/UTBotJava.git)
-2. Open project in IDE
+# UnitTestBot developer guide
-
+---
-β οΈ Important don\`t forgets at this step:
+When you have the forked repository on your local machine, you are almost ready to build your own version of UnitTestBot.
-βοΈ check your Project SDK and Gradle SDK are of 1.8 Java version.
+π‘ Before you start coding, please check the [system requirements](SystemRequirements.md) and find instructions on
+configuring development environment.
-
-
+π‘ Get to know the [code style](https://github.com/saveourtool/diktat/blob/master/info/guide/diktat-coding-convention.md) we are used to.
-βοΈ check your System environment variables: the KOTLIN_HOME variable path should be set up
+## How to build UnitTestBot with your improvements
-
+The project structure is mostly straightforward and the modules are self-explanatory, e.g.:
+* ```utbot-framework``` β everything related to UnitTestBot engine (including tests);
+* ```utbot-intellij``` β IDE plugin implementation;
+* ```utbot-sample``` β a framework with examples to demonstrate engine capacity.
-3. Open Gradle tool window
-4. Launch Task utbot > Tasks > build > assemble
-
-
-
-5. Wait for the build to be completed
-
-Done! You\`re awesome and ready for digging the code. π
-
-
-## Development of UTBot Java with IntelliJ IDEA
-
-The majority of the code is written in Kotlin.
-
-The project is divided into Gradle subprojects. The most significant of them are:
-1. utbot-framework β all about the engine and tests for it
-
-2. utbot-intellij β IDE plugin
-
-3. utbot-sample β a framework with examples to demonstrate engine capacity
-
-## Testing
-
-The project contains many tests. They are usually placed in test root of the particular Gradle subproject.
-
-While developing, it\`s useful to run tests from utbot-framework subproject. The majority of tests from this subproject generate tests for samples from the utbot-sample subproject.
+Learn UnitTestBot from inside and implement changes. To verify your improvements open Gradle tool window in IntelliJ IDEA:
+* to _run/debug plugin_ in IntelliJ IDEA choose and run the task: **utbot β utbot-intellij β intellij β runIde**;
+* to _compile plugin_ choose and run the task: **utbot β utbot-intellij β intellij β buildPlugin**. The resulting ZIP
+ file is located at ```utbot-intellij/build/distributions```.
\ No newline at end of file
diff --git a/HowToUseLoggers.md b/HowToUseLoggers.md
index 0988afdf02..fdb3da4bed 100644
--- a/HowToUseLoggers.md
+++ b/HowToUseLoggers.md
@@ -18,7 +18,7 @@ The file is usually in the resource folder.
The easiest way is:
-- Go in the code that you are going to debug. Letβs assume it is a method in org.utbot.framework.plugin.api.UtBotTestCaseGenerator.
+- Go in the code that you are going to debug. Letβs assume it is a method in org.utbot.framework.plugin.api.TestCaseGenerator.
- Find out if there is a KotlinLogging object that is used to create a **logger**
- If such a logger exists, use the fully qualified class name as the logger name in the next steps
@@ -28,7 +28,7 @@ The easiest way is:
Open log4j2.xml and add the logger in the loggers section like this
```
-
+
```
diff --git a/README.md b/README.md
index 53ff4ab039..a7ee463b78 100644
--- a/README.md
+++ b/README.md
@@ -1,28 +1,96 @@
-[](https://github.com/UnitTestBot/UTBotJava/actions/workflows/build-and-run-tests.yml)
+[](https://github.com/UnitTestBot/UTBotJava/actions/workflows/build-and-run-tests.yml)
[](https://github.com/UnitTestBot/UTBotJava/actions/workflows/publish-plugin-and-cli.yml)
-# What is UTBotJava?
+π Find UnitTestBot on [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/19445-unittestbot).
-UTBotJava generates test cases by code, trying to cover maximum statements and execution paths. We treat source code as source of truth assuming that behavior is correct and corresponds to initial user demand. Generated tests are placed in so-called regression suite. Thus, we fixate current behavior by generated test cases. Using UTBotJava developers obtain full control of their code. No future change can break the code without being noticed once it's covered with tests generated by UTBot. This way, modifications made by developers to an existing code are much safer. Hence, with the help of generated unit tests, UTBot provides dramatic code quality improvement.
+π Visit the [official UnitTestBot website](https://www.utbot.org/).
-# UTBot Java IntelliJ IDEA plugin
+# What is UnitTestBot?
+UnitTestBot is the tool for **automated unit test generation** and **precise code analysis**. It produces ready-to-use
+test
+cases for
+Java β with
+valid inputs and comments. It can even predict whether the tests fail or pass. You can analyze them, run them, show coverage β as if you've created them personally.
-UTBot Java provides users with **IntelliJ IDEA** plugin.
+The **symbolic execution engine** paired with a **smart fuzzing technique** constitutes the core of UnitTestBot. It helps to **find errors** and **prevent regressions** in the code in a much more efficient way β UnitTestBot **maximizes path coverage** while **minimizing the number of tests and false positives**.
-_The plugin was tested on **Win64**, **Linux64** and **MacOSx86_64**._
+UnitTestBot represents all the test summaries in a **human-readable format**. The intelligible test method names and comments help you to control the whole testing process. Test failed? The summary refers you to the related branch or the condition under test.
-# How to download IntelliJ IDEA plugin
+# Get started
+Try the **[online demo](https://www.utbot.org/utbot/)** to generate unit tests with one click.
-You can download the plugin from [GitHub Releases](https://github.com/UnitTestBot/UTBotJava/releases).
+Get to know the **full version** of UnitTestBot plugin with this quick guide:
-# How to install IntelliJ IDEA plugin
+
+ Install UnitTestBot plugin for IntelliJ IDEA
-See [step-by-step guide](https://github.com/UnitTestBot/UTBotJava/wiki/intellij-idea-plugin) explaining how to install the plugin.
+Try the most straightforward path to start using UnitTestBot plugin.
+1. Please check the [system requirements](SystemRequirements.md).
+2. Open your IntelliJ IDEA.
+3. Go to **File β Settings... β Plugins β Marketplace**.
+4. In the search field type *UnitTestBot* β you'll see the UnitTestBot plugin page.
+5. Press the **Install** button and wait until it changes to **Installed**, then click **OK**.
-# How to use IntelliJ IDEA plugin
+Now you can find the UnitTestBot plugin enabled in the **File β Settings β Plugins** window.
-See [step-by-step guide](https://github.com/UnitTestBot/UTBotJava/wiki/generate-tests-with-plugin) explaining how to use the plugin.
+____________
+
-# How to contribute to UTBot Java
+
+ Generate tests with default configuration
-See [**Contributing guidelines**](CONTRIBUTING.md).
+Proceed to generating unit tests for the existing Java project. If you don't have one, create it using the [JetBrains tutorial](https://www.jetbrains.com/help/idea/creating-and-running-your-first-java-application.html).
+
+1. Open your Java project in IntelliJ IDEA.
+2. Right-click the required package or a file in the Project tool window, scroll the menu down to the bottom and choose **Create Tests with UTBot...**
+3. In the **Generate tests with UTBot** window tick the classes or methods you'd like to cover with unit tests and press **OK**.
+
+Now you can see the resulting test class or classes in the Editor tool window.
+
+____________
+
+
+
+ Make use of generated tests
+
+What can you do with the output?
+
+1. To *find and fix the errors* in your code:
+
+* Run the generated tests: right-click the test class or a folder with tests and choose **Run**.
+
+* In the Run tool window you can see the tests failed with the brief failure explanation.
+
+* Fix your errors if needed.
+
+2. To *prevent regressions*:
+
+* Having your errors fixed, run the tests again. "Passed"? Commit them as the regression suite.
+
+* Introduce changes in the code and run your tests as often as needed!
+
+* Tests failed? Decide whether it is a bug or a feature and generate new tests if necessary.
+
+3. To *view coverage*:
+
+Right-click the test class, choose **More Run/Debug β Run ... with Coverage**.
+
+____________
+
+
+# Contribute to UnitTestBot
+UnitTestBot is an open source project. We welcome everyone who wants to make UnitTestBot better β introduce a new feature or report a bug. We have only one kind request for our contributors: we expect you to prove the necessity and quality of the suggested changes.
+
+How can you do this? Refer to our [Contributing guide](https://github.com/UnitTestBot/UTBotJava/blob/main/CONTRIBUTING.md).
+
+Feel free to join the [Discussions](https://github.com/UnitTestBot/UTBotJava/discussions)!
+
+And thank you for your time and effort! β
+
+# Find support
+Having troubles with using UnitTestBot? Contact us [directly](https://www.utbot.org/contact).
+
+# Find more UnitTestBot products
+You can also try [UnitTestBot](https://github.com/UnitTestBot/UTBotCpp) developed especially for C/C++.
+
+You are welcome to [contribute](https://github.com/UnitTestBot/UTBotCpp/blob/main/CONTRIBUTING.md) to it too!
diff --git a/SystemRequirements.md b/SystemRequirements.md
new file mode 100644
index 0000000000..2464bb53bd
--- /dev/null
+++ b/SystemRequirements.md
@@ -0,0 +1,31 @@
+# System requirements
+
+---
+
+### To generate tests with UnitTestBot:
+
+you have to install IntelliJ IDEA (versions from 2022.1 to 2022.1.4 are supported).
+
+### To contribute to UnitTestBot:
+
+you have to install
+
+- IntelliJ IDEA (versions from 2022.1 to 2022.1.4 are supported);
+
+- JDK 11;
+
+- Kotlin 1.7.0 or later.
+
+Please check your development environment:
+
+- ```JAVA_HOME``` environment variable should contain the path to JDK 11 installation directory;
+
+- ```PATH``` environment variable should contain the path to the ```bin``` folder of JDK 11 installation directory;
+
+- ```KOTLIN_HOME``` environment variable should contain the path to the ```kotlinc``` folder of Kotlin (1.7.0 or later) installation
+ directory;
+- Project SDK (1) and Gradle SDK (2) should be set to JDK 11:
+
(1) **IntelliJ IDEA β File β Project Structure β Project Settings β Project β SDK**,
+
(2) **IntelliJ IDEA β File β Settings β Build, Execution, Deployment β Build Tools β Gradle**.
+
+Please note: if the environment variables lead to unsupported JDK or Kotlin versions, you won't be able to build the UnitTestBot project.
diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index 02ef9119b3..0000000000
--- a/build.gradle
+++ /dev/null
@@ -1,67 +0,0 @@
-group 'org.utbot'
-
-apply plugin: 'java'
-
-if (project.hasProperty('semVer')) {
- project.version = project.semVer
-} else {
- project.version = '1.0-SNAPSHOT'
-}
-
-buildscript {
- repositories {
- mavenCentral()
- }
-
- dependencies {
- classpath group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: kotlin_version
- classpath group: 'org.jetbrains.kotlin', name: 'kotlin-allopen', version: kotlin_version
- }
-}
-
-subprojects {
- group = rootProject.group
- version = rootProject.version
-
- apply plugin: 'base'
- apply plugin: 'java'
- apply plugin: 'maven-publish'
-
- publishing {
- publications {
- jar(MavenPublication) {
- from components.java
- groupId 'org.utbot'
- artifactId project.name
- }
- }
- }
-
- repositories {
- mavenCentral()
- maven { url 'https://jitpack.io' }
- }
-}
-
-configure([
- project(':utbot-api'),
- project(':utbot-core'),
- project(':utbot-framework'),
- project(':utbot-framework-api'),
- project(':utbot-fuzzers'),
- project(':utbot-instrumentation'),
- project(':utbot-summary')
-]) {
- publishing {
- repositories {
- maven {
- name = "GitHubPackages"
- url = "https://maven.pkg.github.com/UnitTestBot/UTBotJava"
- credentials {
- username = System.getenv("GITHUB_ACTOR")
- password = System.getenv("GITHUB_TOKEN")
- }
- }
- }
- }
-}
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000..0bfba816d2
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,150 @@
+import org.gradle.api.JavaVersion.VERSION_11
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
+group = "org.utbot"
+
+val kotlinVersion: String by project
+val semVer: String? by project
+val coroutinesVersion: String by project
+val collectionsVersion: String by project
+val junit5Version: String by project
+
+version = semVer ?: "1.0-SNAPSHOT"
+
+plugins {
+ `java-library`
+ kotlin("jvm") version "1.7.10"
+ `maven-publish`
+}
+
+configure {
+ sourceCompatibility = VERSION_11
+ targetCompatibility = VERSION_11
+}
+
+allprojects {
+
+ apply {
+ plugin("maven-publish")
+ plugin("kotlin")
+ }
+
+ tasks {
+ withType {
+ sourceCompatibility = "1.8"
+ targetCompatibility = "1.8"
+ options.encoding = "UTF-8"
+ options.compilerArgs = options.compilerArgs + "-Xlint:all"
+ }
+ withType {
+ kotlinOptions {
+ jvmTarget = "1.8"
+ freeCompilerArgs = freeCompilerArgs + listOf("-Xallow-result-return-type", "-Xsam-conversions=class")
+ allWarningsAsErrors = false
+ }
+ }
+ compileTestKotlin {
+ kotlinOptions {
+ jvmTarget = "1.8"
+ freeCompilerArgs = freeCompilerArgs + listOf("-Xallow-result-return-type", "-Xsam-conversions=class")
+ allWarningsAsErrors = false
+ }
+ }
+ withType {
+ // set heap size for the test JVM(s)
+ minHeapSize = "128m"
+ maxHeapSize = "3072m"
+
+ jvmArgs = listOf("-XX:MaxHeapSize=3072m")
+
+ useJUnitPlatform {
+ excludeTags = setOf("slow", "IntegrationTest")
+ }
+
+ addTestListener(object : TestListener {
+ override fun beforeSuite(suite: TestDescriptor) {}
+ override fun beforeTest(testDescriptor: TestDescriptor) {}
+ override fun afterTest(testDescriptor: TestDescriptor, result: TestResult) {
+ println("[$testDescriptor.classDisplayName] [$testDescriptor.displayName]: $result.resultType")
+ }
+
+ override fun afterSuite(testDescriptor: TestDescriptor, result: TestResult) {
+ if (testDescriptor.parent == null) { // will match the outermost suite
+ println("Test summary: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)")
+ }
+ }
+ })
+ }
+ }
+
+ repositories {
+ mavenCentral()
+ maven("https://jitpack.io")
+ maven("https://plugins.gradle.org/m2")
+ maven("https://www.jetbrains.com/intellij-repository/releases")
+ maven("https://cache-redirector.jetbrains.com/maven-central")
+ }
+
+ dependencies {
+ implementation(group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version = coroutinesVersion)
+ implementation(
+ group = "org.jetbrains.kotlinx",
+ name = "kotlinx-collections-immutable-jvm",
+ version = collectionsVersion
+ )
+ implementation(group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version = kotlinVersion)
+ implementation(group = "org.jetbrains.kotlin", name = "kotlin-reflect", version = kotlinVersion)
+
+ testImplementation("org.junit.jupiter:junit-jupiter") {
+ version {
+ strictly(junit5Version)
+ }
+ }
+ }
+}
+
+subprojects {
+ group = rootProject.group
+ version = rootProject.version
+
+ publishing {
+ publications {
+ create("jar") {
+ from(components["java"])
+ groupId = "org.utbot"
+ artifactId = project.name
+ }
+ }
+ }
+}
+
+dependencies {
+ implementation(group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version = kotlinVersion)
+ implementation(group = "org.jetbrains.kotlin", name = "kotlin-allopen", version = kotlinVersion)
+}
+
+configure(
+ listOf(
+ project(":utbot-api"),
+ project(":utbot-core"),
+ project(":utbot-framework"),
+ project(":utbot-framework-api"),
+ project(":utbot-fuzzers"),
+ project(":utbot-instrumentation"),
+ project(":utbot-rd"),
+ project(":utbot-summary")
+ )
+) {
+ publishing {
+ repositories {
+ maven {
+ name = "GitHubPackages"
+ url = uri("https://maven.pkg.github.com/UnitTestBot/UTBotJava")
+ credentials {
+ username = System.getenv("GITHUB_ACTOR")
+ password = System.getenv("GITHUB_TOKEN")
+ }
+ }
+ }
+ }
+}
diff --git a/docker/Dockerfile_java_cli b/docker/Dockerfile_java_cli
index 35c9536c62..552c436e3c 100644
--- a/docker/Dockerfile_java_cli
+++ b/docker/Dockerfile_java_cli
@@ -1,26 +1,12 @@
-FROM openjdk:8
+FROM azul/zulu-openjdk:11.0.15-11.56.19
-ARG ACCESS_TOKEN
+ARG UTBOT_JAVA_CLI
WORKDIR /usr/src/
-RUN apt-get update \
- && apt-get install -y curl \
- unzip \
- python3 \
- python3-requests \
- && apt-get clean
-
# Install UTBot Java CLI
-COPY docker/get_java_cli_download_url.py .
-ENV JAVA_CLI_ZIP_NAME "utbot_java_cli.zip"
-
-RUN curl -H "Authorization: Bearer ${ACCESS_TOKEN}" \
- -L "$(python3 get_java_cli_download_url.py)" \
- -o "${JAVA_CLI_ZIP_NAME}" \
- && unzip "${JAVA_CLI_ZIP_NAME}" \
- && rm "${JAVA_CLI_ZIP_NAME}"
+COPY ${UTBOT_JAVA_CLI} .
-ENV JAVA_CLI_PATH="$(find /usr/src -type f -name utbot-cli*)"
-RUN ln -s "${JAVA_CLI_PATH}" $pwd/utbot-cli.jar
+RUN UTBOT_JAVA_CLI_PATH="$(find /usr/src -type f -name 'utbot-cli*')" \
+ && ln -s "${UTBOT_JAVA_CLI_PATH}" /usr/src/utbot-cli.jar
diff --git a/docker/get_java_cli_download_url.py b/docker/get_java_cli_download_url.py
deleted file mode 100644
index ad2f6b03a5..0000000000
--- a/docker/get_java_cli_download_url.py
+++ /dev/null
@@ -1,14 +0,0 @@
-import json
-import requests
-
-JAVA_ARTIFACTS_URL="https://api.github.com/repos/UnitTestBot/UTBotJava/actions/artifacts"
-
-request = requests.get(url = JAVA_ARTIFACTS_URL)
-data = request.json()
-artifacts = data['artifacts']
-
-for artifact in artifacts:
- if "utbot-cli" in artifact['name']:
- print(artifact['archive_download_url'])
- break
-
diff --git a/docs/AndroidStudioSupport.md b/docs/AndroidStudioSupport.md
index 7049d52571..c051d53a62 100644
--- a/docs/AndroidStudioSupport.md
+++ b/docs/AndroidStudioSupport.md
@@ -14,8 +14,16 @@
> Install and setup gradle version 7.2+ (version 7.4 tested)
>
-> Use JDK 8 for Gradle in\
+> Use JDK 11 for Gradle in\
> `File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Gradle JVM`
+>
+> \
+> If you want to use JDK 8, you can:
+> 1. Generate tests with JDK 8
+> 2. Switch to JDK 11 and compile tests
+> 3. Switch back to JDK 8 and run tests
+>
+> The reason for it is the Android Gradle Plugin, which requires Java 11 to build anything.
## Running in AS
@@ -23,6 +31,9 @@
> create one like this:
>
>
+>
+> To run generated tests, you must create separate JUnit configuration.\
+> ("Green arrows" will not work, since they launch Android Emulator.)
>
## Debug Intellij code
diff --git a/docs/NightStatisticsMonitoring.md b/docs/NightStatisticsMonitoring.md
new file mode 100644
index 0000000000..2d5ae26cd3
--- /dev/null
+++ b/docs/NightStatisticsMonitoring.md
@@ -0,0 +1,341 @@
+# Night Statistics Monitoring
+
+## What is the problem?
+
+As UnitTestBot contributors, we'd like to constantly improve our product. There are many of us introducing code changes simultaneously β unfortunately, some changes or combinations of them may lead to reduced plugin efficiency. To avoid such an unlucky result we need to monitor statistics on test generation performance.
+
+## Why monitor nightly?
+
+It would be great to collect statistics as soon as the contributor changes the code. In case you have a huge project it takes too long to run the monitoring system after each push into master.
+Thus, we decided to do it every night when (hopefully!) no one makes changes.
+
+## How do we collect statistics?
+
+To find the algorithm you can refer to `StatisticsMonitoring.kt`. Shortly speaking, it is based on `ContestEstimator.kt`, which runs test generation on the sample projects and then compile the resulting tests. We repeat the whole process several times to reduce measurement error.
+
+## Statistics monitoring usage
+
+### Collecting statistics
+
+To run statistics monitoring you have to specify the name of the JSON output file.
+
+Input arguments: `