It's available to download docker image with the environment for UTBot. The environment is also used in the crucial CI scripts focused on building project and running tests.
The docker image pre-installed environment includes:
- Java 17 + JDK package
- Gradle 7.6.1
- Kotlin compiler 1.8.0
It's based on Ubuntu [SOME VERSION].
Using reproducible environment requires Docker installed.
The detailed information of how to install Docker can be found on the official site.
Do the following steps to run tests in docker container:
- Pull docker image
docker pull unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0
- Run docker container
# -v <utbot-repository-root>:/usr/utbot-debug - mounts the host directory into the container directory
# -it - make the container look like a terminal connection session
# -w /usr/utbot-tests - sets up working directory inside the container
docker run -it -v <utbot-repository-root>:/usr/utbot-tests --name utbot-tests -w /usr/utbot-tests unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0
- Do whatever you want
- Build UTBot and run tests:
gradle clean build --no-daemon
- Build UTBot without running tests:
gradle clean build --no-daemon -x test
- Run tests for utbot-framework project CustomerExamplesTest class:
gradle :utbot-framework:test --no-daemon --tests "org.utbot.examples.collections.CustomerExamplesTest"
- Exit container
exit
Do the following steps to debug UTBot in docker container:
- Set up configuration for remote debug in IntelliJ IDEA
Run/Debug Configurations → Add New Configuration → Choose Remote JVM Debug → Set up Configuration name → Ok
- Pull docker image
docker pull unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0
- Run docker container
# -v <utbot-repository-root>:/usr/utbot-debug - mounts the host directory into the container directory
# -it - make the container look like a terminal connection session
# -w /usr/utbot-tests - sets up working directory inside the container
# -p 5005:5005 - mounts the host port into the container port (debugging port)
docker run -it -p 5005:5005 -v <utbot-repository-root>:/usr/utbot-debug --name utbot-debug -w /usr/utbot-tests unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0
- Set up gradle options for remote debug:
export GRADLE_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
- Start building and running tests
gradle clean build --no-daemon
- Attach in IntelliJ IDEA to the gradle process in the container
Set up breakpoints wherever you want → Run new Configuration in Debug mode
- Exit container
exit