# androidx.work.testing

*** ** * ** ***

WorkManager Testing is a library for testing app code that runs using WorkManager.

This testing library provides a way to manually initialize WorkManager for tests by using `https://developer.android.com/reference/androidx/work/testing/WorkManagerTestInitHelper`. Once initialized, you can use `https://developer.android.com/reference/androidx/work/testing/WorkManagerTestInitHelper#getTestDriver(android.content.Context)` to drive constraints and timing-related triggers for your background work.

For ease of testing, this library defaults to using a synchronous `https://developer.android.com/reference/java/util/concurrent/Executor.html`; you can change this in the `https://developer.android.com/reference/androidx/work/Configuration` if you wish.

## Interfaces

|---|---|
| `https://developer.android.com/reference/androidx/work/testing/TestDriver` | Additional functionality exposed for `https://developer.android.com/reference/androidx/work/WorkManager` that are useful in the context of testing. |

## Classes

|---|---|
| `https://developer.android.com/reference/androidx/work/testing/SynchronousExecutor` | Is an implementation of a `https://developer.android.com/reference/java/util/concurrent/Executor.html` which executes `https://developer.android.com/reference/java/lang/Runnable.html`'s synchronously. |
| `https://developer.android.com/reference/androidx/work/testing/TestListenableWorkerBuilder` | Builds instances of `https://developer.android.com/reference/androidx/work/ListenableWorker` which can be used for testing. |
| `https://developer.android.com/reference/androidx/work/testing/TestListenableWorkerBuilderKt` |   |
| `https://developer.android.com/reference/androidx/work/testing/TestWorkerBuilder` | Builds instances of `https://developer.android.com/reference/androidx/work/Worker` which can be used for testing. |
| `https://developer.android.com/reference/androidx/work/testing/TestWorkerBuilderKt` |   |
| `https://developer.android.com/reference/androidx/work/testing/WorkManagerTestInitHelper` | Helps initialize `https://developer.android.com/reference/androidx/work/WorkManager` for testing. |

## Enums

|---|---|
| `https://developer.android.com/reference/androidx/work/testing/WorkManagerTestInitHelper.ExecutorsMode` | Modes that control which executors are used in tests. |