Structure
Conventions
Filesystem
${projectDir} / src / gradleTest / project1 / build.gradle / testTwo.gradle project2 / project3 /
Each directory below gradleTest
becomes a test. Tests are executed in-folder. The
test folder can have more than one build file in it. Each build file will be considered
an individual test that is executed independently of the others.
With multiple build files, it’s important to remember that GradleTest will reuse the existing build directory.
So in the example above, if build.gradle
happens to be executed first, then when
testTwo.gradle
is executed, it will reuse the build folder that was created by build.gradle
.
If this is not desired, then add the clean
task to all your build execution scripts like this:
tasks.register('runGradleTest') { dependsOn 'clean', 'someTask' }
For testing, a folder is created for each gradle version to be tested and the projects are duplicated below the verson folder. Each version’s testsuite is executed within a separate JVM.
${buildDir} / gradleTest / ver 1 / project 1 (1) / project 2 / ver 2 / project 1 / project 2 / manifest.txt (2)
1 | A folder is created for each version and each of the projects (test groups) are listed below |
2 | Custom classpath manifest is so configured. |
... / ver1 / project1 / .gradle (1) / build (2) / build.gradle (3) / settings.gradle (4)
1 | Project cachedir is sent here |
2 | It is recommended that the build directory not be changed and left as per default |
3 | build.gradle is required for the test to be executed. It must contain a task called runGradleTest . |
4 | If a test project does not have a settings.gradle file an empty one will
be generated in the test folder |
Gradle Entities
A GradleTest test set task called main
will have the following associated entities:
Entity | Type | Description |
---|---|---|
|
Task |
The actual |
|
Configuration |
For building the generated test sources. |
|
SourceSet |
Manages internal generated source code |
|
Configuration |
Additional dependencies to pass to the underlying |
|
Configuration |
The actual classpath passe to the underlying |
|
Task |
Generates test code that will be compiled and used to actually executed |
|
Task |
Compiles Groovy code generated by |
|
Task |
Associated |
|
Task |
This task is created if |