---
title: "AndroidComposeUiTest"
description: "Variant of [ComposeUiTest] for when you want to have access the current [activity] of type [A].
The activity might not always be available, for example if the test navigates to another
activity. In such cases, [activity] will return `null`.

An instance of [AndroidComposeUiTest] can be obtained by calling [runAndroidComposeUiTest], the
argument to which will have it as the receiver scope.

Note that any Compose content can be found and tested, regardless if it is hosted by [activity]
or not. What is important, is that the content is set _during_ the lambda passed to
[runAndroidComposeUiTest] (not before, and not after), and that the activity that is actually
hosting the Compose content is in resumed state."
type: "interface"
---

<div class='type'>Interface</div>


<a id='references'></a>

<div class='sourceset sourceset-android'>Android</div>



```kotlin
@ExperimentalTestApi
sealed interface AndroidComposeUiTest<A : ComponentActivity> : ComposeUiTest
```


Variant of `ComposeUiTest` for when you want to have access the current `activity` of type `A`.
The activity might not always be available, for example if the test navigates to another
activity. In such cases, `activity` will return `null`.

An instance of `AndroidComposeUiTest` can be obtained by calling `runAndroidComposeUiTest`, the
argument to which will have it as the receiver scope.

Note that any Compose content can be found and tested, regardless if it is hosted by `activity`
or not. What is important, is that the content is set _during_ the lambda passed to
`runAndroidComposeUiTest` (not before, and not after), and that the activity that is actually
hosting the Compose content is in resumed state.

#### Parameters

| | |
| --- | --- |
| A | The Activity type to be interacted with, which typically (but not necessarily) is the activity that was launched and hosts the Compose content |



## Properties

<div class='sourceset sourceset-android'>Android</div>


```kotlin
val activity: A?
```


Returns the current activity of type `A` used in this `ComposeUiTest`. If no such activity is
available, for example if you've navigated to a different activity and the original host has
now been destroyed, this will return `null`.

Note that you should never hold on to a reference to the Activity, always use `activity` to
interact with the Activity.




