Espresso
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Espresso를 사용하면 간결하고 아름답고 신뢰할 수 있는 Android UI 테스트를 작성할 수 있습니다.
다음 코드 스니펫은 Espresso 테스트의 예를 보여줍니다.
Kotlin
@Test
fun greeterSaysHello() {
onView(withId(R.id.name_field)).perform(typeText("Steve"))
onView(withId(R.id.greet_button)).perform(click())
onView(withText("Hello Steve!")).check(matches(isDisplayed()))
}
자바
@Test
public void greeterSaysHello() {
onView(withId(R.id.name_field)).perform(typeText("Steve"));
onView(withId(R.id.greet_button)).perform(click());
onView(withText("Hello Steve!")).check(matches(isDisplayed()));
}

핵심 API는 작고 예측 가능하며 배우기 쉽지만 공개되어 있습니다.
맞춤설정할 수 있습니다. Espresso 테스트는 기대치, 상호작용 및 어설션 상태를 나타냅니다.
상용구 콘텐츠, 맞춤형 인프라,
복잡한 구현 세부정보가
방해되지 않도록 해야 합니다
Espresso 테스트는 최적의 방식으로 빠르게 실행됩니다. 또한 대기, 동기화, 절전 모드 또는
애플리케이션을 조작하고 어설션하는 동안
UI가 대기 상태일 때의 UI입니다.
타겟층
Espresso는 개발자를 대상으로 하며, 이러한 개발자는 자동화된 테스트가
필수적인 부분입니다. 블랙박스에도 사용할 수 있지만
이 기능에 익숙한 사용자는 Espresso의 모든 기능을 사용할 수 있습니다.
테스트 중인 코드베이스입니다.
동기화 기능
테스트가 호출될 때마다
onView()
님,
Espresso는 상응하는 UI 작업 또는 어설션을 실행하기 위해 대기하다가
다음 동기화 조건이 충족됩니다.
- 메시지 큐에는 Espresso가 즉시 실행해야 하는 메시지가 없습니다.
프로세스입니다
- 현재 실행 중인
AsyncTask
인스턴스가 없습니다.
작업을 수행합니다
- 모든 개발자 정의
유휴 리소스는 유휴 상태입니다.
이러한 검사를 실행하면 Espresso가 더 큰 데이터 세트를
실행할 수 있는 가능성이
하나의 UI 작업 또는 어설션만 발생할 수 있습니다. 이러한 기능은
보다 신뢰할 수 있는 테스트 결과를 제공합니다.
패키지
espresso-core
- 핵심 및 기본 View
매처, 작업,
어설션을 만들 수 있습니다. 자세한 내용은
기본사항
및 레시피를 참조하세요.
espresso-web
- WebView
지원에 관한 리소스가 포함되어 있습니다.
espresso-idling-resource
~
백그라운드 작업과의 동기화를 위한 Espresso의 메커니즘
espresso-contrib
- DatePicker
포함 외부 참여,
RecyclerView
및 Drawer
작업, 접근성 검사
CountingIdlingResource
입니다.
espresso-intents
~
밀폐 테스트를 위해 인텐트를 검사하고 스텁하는 확장 프로그램입니다.
espresso-remote
- Espresso의 멀티 프로세스 기능의 위치입니다.
최신 버전에 대한 자세한 내용은
출시 노트에서 확인하세요.
추가 리소스
Android 테스트에서 Espresso를 사용하는 방법에 관한 자세한 내용은
확인할 수 있습니다
샘플
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Espresso\n\nUse Espresso to write concise, beautiful, and reliable Android UI tests.\n\nThe following code snippet shows an example of an Espresso test:\n\n\u003cbr /\u003e\n\n### Kotlin\n\n```kotlin\n@Test\nfun greeterSaysHello() {\n onView(withId(R.id.name_field)).perform(typeText(\"Steve\"))\n onView(withId(R.id.greet_button)).perform(click())\n onView(withText(\"Hello Steve!\")).check(matches(isDisplayed()))\n}\n```\n\n### Java\n\n```java\n@Test\npublic void greeterSaysHello() {\n onView(withId(R.id.name_field)).perform(typeText(\"Steve\"));\n onView(withId(R.id.greet_button)).perform(click());\n onView(withText(\"Hello Steve!\")).check(matches(isDisplayed()));\n}\n```\n\n\u003cbr /\u003e\n\nThe core API is small, predictable, and easy to learn and yet remains open for\ncustomization. Espresso tests state expectations, interactions, and assertions\nclearly without the distraction of boilerplate content, custom infrastructure,\nor messy implementation details getting in the way.\n\nEspresso tests run optimally fast! It lets you leave your waits, syncs, sleeps,\nand polls behind while it manipulates and asserts on the application\nUI when it is at rest.\n\nTarget audience\n---------------\n\nEspresso is targeted at developers, who believe that automated testing is an\nintegral part of the development lifecycle. While it can be used for black-box\ntesting, Espresso's full power is unlocked by those who are familiar with the\ncodebase under test.\n\nSynchronization capabilities\n----------------------------\n\nEach time your test invokes\n[`onView()`](/reference/androidx/test/espresso/Espresso#onView(org.hamcrest.Matcher%3Candroid.view.View%3E)),\nEspresso waits to perform the corresponding UI action or assertion until the\nfollowing synchronization conditions are met:\n\n- The message queue doesn't have any messages that Espresso needs to immediately process.\n- There are no instances of [AsyncTask](/reference/android/os/AsyncTask) currently executing a task.\n- All developer-defined [idling resources](/training/testing/espresso/idling-resource) are idle.\n\nBy performing these checks, Espresso substantially increases the likelihood that\nonly one UI action or assertion can occur at any given time. This capability\ngives you more reliable and dependable test results.\n\nPackages\n--------\n\n- `espresso-core` - Contains core and basic `View` matchers, actions, and assertions. See [Basics](/training/testing/espresso/basics) and [Recipes](/training/testing/espresso/recipes).\n- [`espresso-web`](/training/testing/espresso/web) - Contains resources for `WebView` support.\n- [`espresso-idling-resource`](/training/testing/espresso/idling-resource) - Espresso's mechanism for synchronization with background jobs.\n- `espresso-contrib` - External contributions that contain `DatePicker`, `RecyclerView` and `Drawer` actions, accessibility checks, and `CountingIdlingResource`.\n- [`espresso-intents`](/training/testing/espresso/intents) - Extension to validate and stub intents for hermetic testing.\n- `espresso-remote` - Location of Espresso's [multi-process](/training/testing/espresso/multiprocess) functionality.\n\nYou can learn more about the latest versions by reading the\n[release notes](/topic/libraries/testing-support-library/release-notes).\n\nAdditional resources\n--------------------\n\nFor more information about using Espresso in Android tests, consult the\nfollowing resources.\n\n### Samples\n\n- [Espresso Code Samples](https://github.com/googlesamples/android-testing) includes a full selection of Espresso samples.\n- [BasicSample](https://github.com/android/testing-samples/tree/main/ui/espresso/BasicSample): Basic Espresso sample.\n- [(more...)](/training/testing/espresso/additional-resources#samples)"]]