# InstantTaskExecutorRule

Artifact: [androidx.arch.core:core-testing](https://developer.android.com/jetpack/androidx/releases/arch-core) [View Source](https://cs.android.com/search?q=file:androidx/arch/core/executor/testing/InstantTaskExecutorRule.java+class:androidx.arch.core.executor.testing.InstantTaskExecutorRule) Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/arch-core#2.0.0)

*** ** * ** ***


```
class InstantTaskExecutorRule : TestWatcher
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [org.junit.rules.TestWatcher](https://junit.org/junit4/javadoc/latest/org/junit/rules/TestWatcher.html) ||
|   | ↳ | [androidx.arch.core.executor.testing.InstantTaskExecutorRule](https://developer.android.com/reference/kotlin/androidx/arch/core/executor/testing/InstantTaskExecutorRule) |

*** ** * ** ***

A JUnit Test Rule that swaps the background executor used by the Architecture Components with a different one which executes each task synchronously.

You can use this rule for your host side tests that use Architecture Components.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/arch/core/executor/testing/InstantTaskExecutorRule#InstantTaskExecutorRule()()` |

| ### Protected functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/arch/core/executor/testing/InstantTaskExecutorRule#finished(org.junit.runner.Description)(description: https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html!)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/arch/core/executor/testing/InstantTaskExecutorRule#starting(org.junit.runner.Description)(description: https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html!)` |

| ### Inherited functions |
|---|
| From [org.junit.rules.TestWatcher](https://junit.org/junit4/javadoc/latest/org/junit/rules/TestWatcher.html) |---|---| | `https://junit.org/junit4/javadoc/latest/org/junit/runners/model/Statement.html!` | `https://junit.org/junit4/javadoc/latest/org/junit/rules/TestWatcher.html#apply-org.junit.runners.model.Statement-org.junit.runner.Description-(base: https://junit.org/junit4/javadoc/latest/org/junit/runners/model/Statement.html!, description: https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html!)` | | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://junit.org/junit4/javadoc/latest/org/junit/rules/TestWatcher.html#failed-java.lang.Throwable-org.junit.runner.Description-(e: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html!, description: https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html!)` | | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://junit.org/junit4/javadoc/latest/org/junit/rules/TestWatcher.html#skipped-org.junit.AssumptionViolatedException-org.junit.runner.Description-(e: https://junit.org/junit4/javadoc/latest/org/junit/AssumptionViolatedException.html!, description: https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html!)` | | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://junit.org/junit4/javadoc/latest/org/junit/rules/TestWatcher.html#succeeded-org.junit.runner.Description-(description: https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html!)` | |

## Public constructors

### InstantTaskExecutorRule

Added in 2.0.0

```
InstantTaskExecutorRule()
```

## Protected functions

### finished

```
protected fun finished(description: Description!): Unit
```

### starting

```
protected fun starting(description: Description!): Unit
```