# TransformTestScope

Artifact: [androidx.appstate.transform:transform-testing](https://developer.android.com/jetpack/androidx/releases/appstate-transform) [View Source](https://cs.android.com/search?q=file:androidx/appstate/transform/testing/TransformTest.kt+class:androidx.appstate.transform.testing.TransformTestScope) Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appstate-transform#1.0.0-alpha02) Common/AllAndroid/JVM
- Cmn

  ```
  sealed interface TransformTestScope : CoroutineScope
  ```

*** ** * ** ***

A test scope used in tests that allows controlling and testing transforms.

## Summary

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appstate/transform/TransformScope` | `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#TransformScope()()` Creates a `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#TransformScope()` for use in this `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#advance()()` Advance the state which executes any pending transforms, if any. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#advanceTimeBy(kotlin.time.Duration)(duration: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.time/-duration/index.html)` Advance the clock by `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#advanceTimeBy(kotlin.time.Duration)` | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#advanceUntilIdle()()` Advance the clock until no work is scheduled | Cmn |
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/appstate/transform/TransformScope.https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#(androidx.appstate.transform.TransformScope).run()()` Starts this `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#TransformScope()` in the test environment and begins the process of updating its state transformations. | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html` | `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#backgroundScope()` Scope for work that must not block test completion, such as running transforms. | Cmn |
| `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-test/kotlinx.coroutines.test/-test-coroutine-scheduler/index.html` | `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#testCoroutineScheduler()` A scheduler used by `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html` | Cmn |
| `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-test/kotlinx.coroutines.test/-test-dispatcher/index.html` | `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#testDispatcher()` The dispatcher to run transforms on, so that `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#advance()` executes their transforms. | Cmn |

### Inherited properties

From [kotlinx.coroutines.CoroutineScope](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/coroutine-context.html` Cmn

## Public functions

### TransformScope

Cmn Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appstate-transform#1.0.0-alpha02)

```
fun TransformScope(): TransformScope
```

Creates a `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#TransformScope()` for use in this `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope`.

### advance

Cmn Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appstate-transform#1.0.0-alpha02)

```
fun advance(): Unit
```

Advance the state which executes any pending transforms, if any.

### advanceTimeBy

Cmn Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appstate-transform#1.0.0-alpha02)

```
fun advanceTimeBy(duration: Duration): Unit
```

Advance the clock by `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#advanceTimeBy(kotlin.time.Duration)`

### advanceUntilIdle

Cmn Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appstate-transform#1.0.0-alpha02)

```
fun advanceUntilIdle(): Unit
```

Advance the clock until no work is scheduled

### TransformScope.run

Cmn Artifact: [androidx.appstate.transform:transform-testing](https://developer.android.com/jetpack/androidx/releases/appstate-transform) [View Source](https://cs.android.com/search?q=file:androidx/appstate/transform/testing/TransformTest.kt+function:run) Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appstate-transform#1.0.0-alpha02)

```
suspend fun TransformScope.run(): Unit
```

Starts this `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#TransformScope()` in the test environment and begins the process of updating its state transformations.

## Public properties

### backgroundScope

Cmn Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appstate-transform#1.0.0-alpha02)

```
val backgroundScope: CoroutineScope
```

Scope for work that must not block test completion, such as running transforms. Cancelled when the test completes, which disposes the transforms running in it.

### testCoroutineScheduler

Cmn Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appstate-transform#1.0.0-alpha02)

```
val testCoroutineScheduler: TestCoroutineScheduler
```

A scheduler used by `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html`

### testDispatcher

Cmn Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appstate-transform#1.0.0-alpha02)

```
val testDispatcher: TestDispatcher
```

The dispatcher to run transforms on, so that `https://developer.android.com/reference/kotlin/androidx/appstate/transform/testing/TransformTestScope#advance()` executes their transforms.