package

androidx.work.testing

Overview

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 WorkManagerTestInitHelper. Once initialized, you can use WorkManagerTestInitHelper to drive constraints and timing-related triggers for your background work.

For ease of testing, this library defaults to using a synchronous java.util.concurrent.Executor; you can change this in the Configuration if you wish.

Interfaces

TestDriverAdditional functionality exposed for WorkManager that are useful in the context of testing.

Classes

SynchronousExecutorIs an implementation of a java.util.concurrent.Executor which executes java.lang.Runnable's synchronously.
TestForegroundUpdaterA ForegroundUpdater which does nothing.
TestListenableWorkerBuilder<W>Builds instances of ListenableWorker which can be used for testing.
TestProgressUpdaterA ProgressUpdater which does nothing.
TestWorkerBuilder<W>Builds instances of Worker which can be used for testing.
WorkManagerTestInitHelperHelps initialize WorkManager for testing.