Structure
Conventions
Filesystem
${projectDir} / src / gradleTest / project1 / build.gradle / staged.testTwo.build.gradle project2 / project3 /
Each directory below gradleTest
becomes a test as long as it contains a valid build file.
A build file is considered valid if it is named build.gradle
, build.gradle.kts
, staged.<SOMETHING>.build.gradle
or staged.<SOMETHING>.build.gradle.kts
, where <SOMETHING>
can be anythign chosen by the plugin author.
The test folder can have more than one build file in it as long as it is named as mentioned above. Each build file will be considered an individual test that is executed independently of the others.
Separate test directories are created for each test, but symlinks are created within the test directories back to the original source directories. In some cases this might result in files appearing in the source directory.
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 version 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 |