Gradle
Dependencies
- Ubuntu / Debian
- Arch
- macOS
- Windows
sudo apt install default-jdk gradle
sudo pacman -S jdk-openjdk gradle
brew install openjdk gradle
choco install microsoft-openjdk gradle
Version Requirements
Android Limitations
Android Fuzz Tests running in an emulator or on a device are not supported, but it is still possible to run local tests. The following prerequisites are required:
- Gradle >= 7.5
- Android Gradle Plugin >= 7.4.2
Initialize a Project
Initialize CI Fuzz in the root directory of your Gradle project with the following command:
cifuzz init
Enable CI Repository Access
To use CI Fuzz and its dependencies, you have to configure access to the CI repository. Your username and private token are available on your CI Download Portal Configuration page.
gradle.properties
Add the following repository credentials to your ~/.gradle/gradle.properties
file:
CodeIntelligenceRepositoryUsername=<YOUR_USERNAME>
CodeIntelligenceRepositoryPassword=<YOUR_TOKEN>
settings.gradle
To be able to access the plugin, add the CI repository as a plugin repository to your project settings:
- Groovy
- Kotlin
pluginManagement {
repositories {
maven {
name "CodeIntelligenceRepository"
url "https://gitlab.code-intelligence.com/api/v4/projects/89/packages/maven"
credentials {
username CodeIntelligenceRepositoryUsername
password CodeIntelligenceRepositoryPassword
}
content {
includeGroupByRegex("com\\.code-intelligence.*")
}
}
gradlePluginPortal()
}
}
pluginManagement {
repositories {
maven {
name = "CodeIntelligenceRepository"
url = uri("https://gitlab.code-intelligence.com/api/v4/projects/89/packages/maven")
credentials {
username = extra["CodeIntelligenceRepositoryUsername"].toString()
password = extra["CodeIntelligenceRepositoryPassword"].toString()
}
content {
includeGroupByRegex("com\\.code-intelligence.*")
}
}
gradlePluginPortal()
}
}
build.gradle
To resolve CI Fuzz dependencies, also add the CI repository in your projects build file:
- Groovy
- Kotlin
repositories {
maven {
name "CodeIntelligenceRepository"
url "https://gitlab.code-intelligence.com/api/v4/projects/89/packages/maven"
credentials {
username CodeIntelligenceRepositoryUsername
password CodeIntelligenceRepositoryPassword
}
content {
includeGroupByRegex("com\\.code-intelligence.*")
}
}
mavenCentral()
}
repositories {
maven {
name = "CodeIntelligenceRepository"
url = uri("https://gitlab.code-intelligence.com/api/v4/projects/89/packages/maven")
credentials {
username = extra["CodeIntelligenceRepositoryUsername"].toString()
password = extra["CodeIntelligenceRepositoryPassword"].toString()
}
content {
includeGroupByRegex("com\\.code-intelligence.*")
}
}
mavenCentral()
}
Add Gradle Plugin
Add the CI Fuzz Gradle plugin to your projects build file to enable fuzz testing:
- Groovy
- Kotlin
plugins {
id "com.code-intelligence.cifuzz" version "1.17.0"
}
plugins {
id("com.code-intelligence.cifuzz") version "1.17.0"
}
JUnit
Fuzz tests are executed with JUnit 5. If it is not already set up, the plugin will automatically add the required dependencies and configuration to your project. If you are using JUnit 4, please be aware that you will need to use the JUnit Vintage engine to be able to run both JUnit 4 and Junit 5 tests in one project. See the official JUnit documentation for more information.