- Junit 4/5 required, due to the original iDFlakies' dependency requirement.
- Scala (if the project uses Scala) version should be < 2.13, due to the original iDFlakies' dependency requirement and backward incompatibility for some Scala functions.
- Gradle (if kotlin is used): [5.0, 6.5.1], due to gradle internal bugs: gradle/gradle#14727. Otherwise, there's no requirement on Gradle version.
Run the following command to automatically setup the build.gradle for iDFlakies.
bash gradle-modify/modify_gradle.sh path_to_gradle_project
We can configure the build.gradle file manually instead. We need to follow the rule listed below to successfully set up the project.
- First we need to add the following dependencies and repository to the
buildscript{}
in build.gradlebuildscript { repositories { ... mavenCentral() } dependencies { ... classpath group: 'edu.illinois.cs', name: 'idflakies', /* use iDFlakies from Maven Central */ version: '1.1.0' /* use the following version instead if you have built iDFlakies locally and want to use the locally built version*/ /* version: '1.2.0-SNAPSHOT'*/ /* For instructions on building iDFlakies locally, please see 'Use locally built version of iDFlakies' section below in this document. */ classpath group: 'edu.illinois.cs', name: 'testrunner-gradle-plugin', version: '1.2' ... } }
- Then, add
apply plugin: 'testrunner'
to the build.gradle file. The location of this code snippet depends on whether build.gradle file hasallprojects{}
andsubprojects{}
.- If there are both
allprojects{}
andsubprojects{}
methods in gradle.build, then theapply plugin: "testrunner"
command should be added to the end ofsubprojects{}
and the root (outside of all methods in the build file).- Example:
buildscript { repositories { mavenCentral() } dependencies { classpath group: 'edu.illinois.cs', name: 'idflakies', version: '1.1.0' classpath group: 'edu.illinois.cs', name: 'testrunner-gradle-plugin', version: '1.2' } } allprojects { repositories { mavenCentral() } } subprojects { apply plugin: 'maven' apply plugin: 'signing' apply plugin: 'checkstyle' /* add apply plugin: "testrunner" to the end of the subproject{} */ apply plugin: 'testrunner' } /* add apply plugin: "testrunner" to the root */ apply plugin: 'testrunner'
- Example:
- If only
allprojects{}
method is in gradle.build, the command is added toallprojects{}
only.- Example:
buildscript { repositories { mavenCentral() } dependencies { classpath group: 'edu.illinois.cs', name: 'idflakies', version: '1.1.0' classpath group: 'edu.illinois.cs', name: 'testrunner-gradle-plugin', version: '1.2' } } allprojects { repositories { mavenCentral() } /* add apply plugin: "testrunner" to the end of the allprojects{} only */ apply plugin: 'testrunner' }
- Example:
- If only
subprojects{}
method is in gradle.build, the command is added to both the end ofsubprojects{}
and the root.- Example:
buildscript { repositories { mavenCentral() } dependencies { classpath group: 'edu.illinois.cs', name: 'idflakies', version: '1.1.0' classpath group: 'edu.illinois.cs', name: 'testrunner-gradle-plugin', version: '1.2' } } subprojects { apply plugin: 'maven' apply plugin: 'signing' apply plugin: 'checkstyle' /* add apply plugin: "testrunner" to the end of the subproject{} */ apply plugin: 'testrunner' } /* add apply plugin: "testrunner" to the root */ apply plugin: 'testrunner'
- Example:
- If there's no
allprojects{}
andsubprojects{}
in gradle.build, only add the command to the root.- Example:
buildscript { repositories { mavenCentral() } dependencies { classpath group: 'edu.illinois.cs', name: 'idflakies', version: '1.1.0' classpath group: 'edu.illinois.cs', name: 'testrunner-gradle-plugin', version: '1.2' } } apply plugin: 'testrunner'
- Example:
- If there are both
- For each subproject with build.gradle file in its directory, append
apply plugin: 'testrunner'
to the end of the build.gradle in each subproject.
Go to iDFlakies root directory, and run the following command to install iDFlakies locally:
mvn clean install
Modify build.gradle according to the code snippet below. MavenLocal()
should be added to make sure the plugin uses locally built iDFlakies. The version of the iDFlakies should be set to '1.2.0-SNAPSHOT'.
buildscript {
repositories {
...
mavenCentral()
/* use mavenLocal() for locally built iDFlakies*/
mavenLocal()
}
dependencies {
...
classpath group: 'edu.illinois.cs',
name: 'idflakies',
/* use locally built iDFlakies */
version: '1.2.0-SNAPSHOT'
classpath group: 'edu.illinois.cs',
name: 'testrunner-gradle-plugin',
version: '1.2'
...
}
}
After the build.gradle has been configured, one can run iDFlakies on the Gradle project with the following command:
./gradlew testplugin -Dtestplugin.className=edu.illinois.cs.dt.tools.detection.DetectorPlugin -Ddetector.detector_type=random-class-method -Ddt.randomize.rounds=10 -Ddt.detector.original_order.all_must_pass=false
This spreadsheet shows all the projects we have tested, and their compatibility with the Gradle modify tool and the iDFlakies plugin.