com.vinaysshenoy.quarantine.QuarantineTestRule.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarantine-junit4 Show documentation
Show all versions of quarantine-junit4 Show documentation
The client for integrating JUnit4 tests with Quarantine
The newest version!
package com.vinaysshenoy.quarantine
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
class QuarantineTestRule : TestRule {
private val repository: TestRepository by lazy { Quarantine.repository }
init {
ReportFlakyTestsOnComplete.setup(repository)
}
override fun apply(statement: Statement, description: Description): Statement {
val shouldQuarantineTests = repository.config().enabled
return if (shouldQuarantineTests) {
QuarantinedStatement(
repository = repository,
flakyTestRetryCount = 10,
base = statement,
description = description
)
} else {
statement
}
}
}