Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ Change the log4j setting in either `clients/src/test/resources/log4j.properties`

./gradlew clients:test --tests RequestResponseTest

### Specifying test retries ###
By default, each failed test is retried once up to a maximum of five retries per test run. Tests are retried at the end of the test task. Adjust these parameters in the following way:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should update this line that by default it is not retrying.


./gradlew test -PmaxTestRetries=1 -PmaxTestRetryFailures=5

See [Test Retry Gradle Plugin](https://github.com/gradle/test-retry-gradle-plugin) for more details.

### Generating test coverage reports ###
Generate coverage reports for the whole project:

Expand Down Expand Up @@ -191,6 +198,8 @@ The following options should be set with a `-P` switch, for example `./gradlew -
* `skipSigning`: skips signing of artifacts.
* `testLoggingEvents`: unit test events to be logged, separated by comma. For example `./gradlew -PtestLoggingEvents=started,passed,skipped,failed test`.
* `xmlSpotBugsReport`: enable XML reports for spotBugs. This also disables HTML reports as only one can be enabled at a time.
* `maxTestRetries`: the maximum number of retries for a failing test case.
* `maxTestRetryFailures`: maximum number of test failures before retrying is disabled for subsequent tests.

### Dependency Analysis ###

Expand Down
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ buildscript {
classpath "org.owasp:dependency-check-gradle:$versions.owaspDepCheckPlugin"
classpath "com.diffplug.spotless:spotless-plugin-gradle:$versions.spotlessPlugin"
classpath "com.github.spotbugs:spotbugs-gradle-plugin:$versions.spotbugsPlugin"
classpath "org.gradle:test-retry-gradle-plugin:$versions.testRetryPlugin"
}
}

Expand Down Expand Up @@ -97,6 +98,9 @@ ext {

userMaxForks = project.hasProperty('maxParallelForks') ? maxParallelForks.toInteger() : null

userMaxTestRetries = project.hasProperty('maxTestRetries') ? maxTestRetries.toInteger() : 0
userMaxTestRetryFailures = project.hasProperty('maxTestRetryFailures') ? maxTestRetryFailures.toInteger() : 0

skipSigning = project.hasProperty('skipSigning') && skipSigning.toBoolean()
shouldSign = !skipSigning && !version.endsWith("SNAPSHOT") && project.gradle.startParameter.taskNames.any { it.contains("upload") }

Expand Down Expand Up @@ -163,6 +167,7 @@ subprojects {
apply plugin: 'signing'
apply plugin: 'checkstyle'
apply plugin: "com.github.spotbugs"
apply plugin: 'org.gradle.test-retry'

sourceCompatibility = minJavaVersion
targetCompatibility = minJavaVersion
Expand Down Expand Up @@ -289,6 +294,11 @@ subprojects {
exceptionFormat = testExceptionFormat
}
logTestStdout.rehydrate(delegate, owner, this)()

retry {
maxRetries = userMaxTestRetries
maxFailures = userMaxTestRetryFailures
}
}

task integrationTest(type: Test, dependsOn: compileJava) {
Expand Down
1 change: 1 addition & 0 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ versions += [
spotbugs: "3.1.12",
spotbugsPlugin: "3.0.0",
spotlessPlugin: "3.27.1",
testRetryPlugin: "1.1.0",
zookeeper: "3.5.6",
zstd: "1.4.4-7"
]
Expand Down