# Adding Compose to Existing Espresso Tests with createEmptyComposeRule()

DevFeed: [Adding Compose to Existing Espresso Tests with createEmptyComposeRule()](<https://devfeed.tech/articles/adding-compose-to-existing-espresso-tests-with-createemptycomposerule-25123.md>)

Original publisher: [Read original article](<https://handstandsam.com/2023/04/12/adding-compose-to-existing-espresso-tests-with-createemptycomposerule/>)

Author: Sam Edwards

Published: 2023-04-12T13:46:30Z

Content type: tutorial

Language: en

Sources: [Handstand Sam](<https://devfeed.tech/sources/handstand-sam.md>)

Topics: [Compose](<https://devfeed.tech/topics/compose.md>), [Android](<https://devfeed.tech/topics/android.md>), [Instrumentation](<https://devfeed.tech/topics/instrumentation.md>), [test](<https://devfeed.tech/topics/test.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [compose](<https://devfeed.tech/tags/compose.md>), [espresso](<https://devfeed.tech/tags/espresso.md>), [instrumentation](<https://devfeed.tech/tags/instrumentation.md>), [test](<https://devfeed.tech/tags/test.md>), [tests](<https://devfeed.tech/tags/tests.md>), [updates](<https://devfeed.tech/tags/updates.md>)

## AI overview

This tutorial explains how to interact with Jetpack Compose elements in existing Android Espresso instrumentation tests without changing the test's existing Activity behavior. It recommends using createEmptyComposeRule() instead of rules that create or launch an Activity.

## Source excerpt

As the documentation says, you can combine both Espresso and Compose in an Android instrumentation test. In order to interact with Compose in an instrumentation test you need a ComposeTestRule. Problem Typically you would create a ComposeTestRule with createComposeRule() in a part of your app that is compose only, but that will create a blank [...]