# Testing en Android (Android) > JUnit, Espresso, pruebas unitarias, pruebas instrumentadas, assertions - 28 preguntas de entrevista - Junior - [Preguntas de entrevista: Android](https://sharpskill.dev/es/technologies/android/preguntas-entrevista.md) ## 1. ¿Qué es JUnit? **Respuesta** JUnit es un framework de pruebas unitarias para Java y Kotlin. Es el estándar para escribir y ejecutar pruebas automatizadas. JUnit 4 utiliza anotaciones (@Test, @Before, @After) para definir las pruebas y su ciclo de vida. Las pruebas JUnit son rápidas porque se ejecutan en la JVM local sin emulador Android. ## 2. ¿Para qué sirve la anotación @Test? **Respuesta** @Test marca un método como prueba unitaria. El método será ejecutado por el test runner. Sin @Test, el método se ignora. Ejemplo: @Test fun testAddition() { assertEquals(4, 2 + 2) }. Cada @Test debe ser independiente y no depender del orden de ejecución. ## 3. ¿Para qué sirve la anotación @Before? **Respuesta** @Before marca un método que se ejecuta ANTES de cada prueba (@Test). Útil para inicializar objetos comunes, crear mocks, reiniciar estado. Ejemplo: @Before fun setUp() { viewModel = MyViewModel() }. Si tienes 5 pruebas, @Before se ejecuta 5 veces. Alternativa: @BeforeClass para una sola ejecución antes de todas las pruebas. ## 25 preguntas más disponibles - ¿Para qué sirve la anotación @After? - ¿Qué es una assertion en testing? Regístrate gratis: https://sharpskill.dev/es/login ## Otros temas de entrevista Android - [Fundamentos de Android](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-fundamentals.md): 24 preguntas, Junior - [UI y Recursos Android](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-ui-and-resources.md): 30 preguntas, Junior - [Ciclo de Vida de Android](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-lifecycle.md): 30 preguntas, Junior - [Navegación Android](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-navigation.md): 26 preguntas, Junior - [Gestión de Datos Android](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-data-management.md): 29 preguntas, Junior - [Redes Android](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-networking.md): 29 preguntas, Junior - [Android Gradle](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-gradle.md): 26 preguntas, Junior - [Fundamentos del lenguaje Kotlin para Android](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-kotlin-language-essentials.md): 24 preguntas, Junior - [Room Database](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-room-database.md): 25 preguntas, Mid-Level - [Trabajo en segundo plano](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-background-work.md): 18 preguntas, Mid-Level - [Jetpack Compose](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-compose.md): 28 preguntas, Mid-Level - [Permisos y Funciones del Dispositivo](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-permissions-and-device.md): 21 preguntas, Mid-Level - [Firebase para Android](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-firebase.md): 23 preguntas, Mid-Level - [Android MVVM Architecture](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-mvvm-architecture.md): 18 preguntas, Mid-Level - [Redes Android Avanzadas](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-networking-advanced.md): 13 preguntas, Mid-Level - [Colecciones y Operadores de Kotlin](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-kotlin-collections-operators.md): 20 preguntas, Mid-Level - [Kotlin Coroutines y Flow](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-kotlin-coroutines-flow.md): 20 preguntas, Mid-Level - [Inyección de Dependencias en Android](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-dependency-injection.md): 15 preguntas, Mid-Level - [Android MVI Architecture](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-mvi-architecture.md): 17 preguntas, Mid-Level - [Android Clean Architecture](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-clean-architecture.md): 21 preguntas, Senior - [Android Compose Avanzado](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-compose-advanced.md): 17 preguntas, Senior - [Android Performance and Monitoring](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-performance-monitoring.md): 13 preguntas, Senior - [Android Security and Privacy](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-security-privacy.md): 18 preguntas, Senior - [Android CI/CD and Release](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-cicd-release.md): 15 preguntas, Senior - [Android UX and Form Factors](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-ux-form-factors.md): 18 preguntas, Senior - [Android Testing Advanced](https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-testing-advanced.md): 18 preguntas, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/es/technologies/android/preguntas-entrevista/android-testing