# 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)

*** ** * ** ***


```
public class InstantTaskExecutorRule extends TestWatcher
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.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/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/androidx/arch/core/executor/testing/InstantTaskExecutorRule#InstantTaskExecutorRule()()` |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/arch/core/executor/testing/InstantTaskExecutorRule#finished(org.junit.runner.Description)(https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html description)` |
| `void` | `https://developer.android.com/reference/androidx/arch/core/executor/testing/InstantTaskExecutorRule#starting(org.junit.runner.Description)(https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html description)` |

| ### Inherited methods |
|---|
| 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-(https://junit.org/junit4/javadoc/latest/org/junit/runners/model/Statement.html base, https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html description)` | | `void` | `https://junit.org/junit4/javadoc/latest/org/junit/rules/TestWatcher.html#failed-java.lang.Throwable-org.junit.runner.Description-(https://developer.android.com/reference/java/lang/Throwable.html e, https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html description)` | | `void` | `https://junit.org/junit4/javadoc/latest/org/junit/rules/TestWatcher.html#skipped-org.junit.AssumptionViolatedException-org.junit.runner.Description-(https://junit.org/junit4/javadoc/latest/org/junit/AssumptionViolatedException.html e, https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html description)` | | `void` | `https://junit.org/junit4/javadoc/latest/org/junit/rules/TestWatcher.html#succeeded-org.junit.runner.Description-(https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html description)` | |

## Public constructors

### InstantTaskExecutorRule

Added in 2.0.0

```
public InstantTaskExecutorRule()
```

## Protected methods

### finished

```
protected void finished(Description description)
```

### starting

```
protected void starting(Description description)
```