MockkRetryTestRule

class MockkRetryTestRule(maxTries: Int = MAX_RETRIES_COUNT_DEFAULT) : TestRule

TestRule to work around mockk problem that causes intermittent failures of tests with mocked lambdas.

This rule retries running the failing test until maxTries is reached.

Note: The test class is not recreated between retries. This means that mocks cannot be created in an init block or as properties of a class. Mutable properties which that can affect tests should also be reset in the before or test blocks.

Constructors

Link copied to clipboard
fun MockkRetryTestRule(maxTries: Int = MAX_RETRIES_COUNT_DEFAULT)

Functions

Link copied to clipboard
open override fun apply(base: Statement, description: Description): Statement