Android Test Framework

Android Test Framework

  • Incluído na SDK do Android
  • Baseado no JUnit 3
  • Rodam em devices ou emuladores


  • Utilizar apenas a ATFramework é trabalhoso, maçante;
  • Considerado uma extensão do ATFramework;
  • Sua classe principal é a Solo.

dependencies {

    compile 'com.jayway.android.robotium:robotium-solo:5.2.1'

android {
   sourceSets {
     androidTest {
       java.srcDirs = ['src/androidTest/java']

"Running tests on an Android emulator or device is slow! Building, deploying, and launching the app often takes a minute or more. That's no way to do TDD. There must be a better way."

"Tests run inside the JVM on your workstation in seconds."

"Robolectric makes this possible by rewriting Android SDK classes as they're being loaded and making it possible for them to run on a regular JVM."

Configurar o Android Studio ainda está muito doloroso...


Problemas com support v7


Nada certo!

A esperança!

Android JUnit Runner

The AndroidJUnitRunner class is a JUnit test runner that lets you run JUnit 3 or JUnit 4-style test classes on Android devices, including those using the Espresso and UI Automator testing frameworks. The test runner handles loading your test package and the app under test to a device, running your tests, and reporting test results. This class replaces the InstrumentationTestRunner class, which only supports JUnit 3 tests.

UI Automator

The UI Automator testing framework provides a set of APIs to build UI tests that perform interactions on user apps and system apps. The UI Automator APIs allows you to perform operations such as opening the Settings menu or the app launcher in a test device. The UI Automator testing framework is well-suited for writing black box-style automated tests, where the test code does not rely on internal implementation details of the target app.


The Espresso testing framework provides a set of APIs to build UI tests to test user flows within an app. These APIs let you write automated UI tests that are concise and that run reliably. Espresso is well-suited for writing white box-style automated tests, where the test code utilizes implementation code details from the app under test.


Minha implementação de UnitTest e Espresso


Exemplos da Google c/ UnitTest, Espresso e UIAutomator


Promete AppCompat v7 & Robolectric


Mais ferramentas

Continuous Integration




Desenv. de apps móveis para Android (Testing)

By Ricardo Longa

Desenv. de apps móveis para Android (Testing)

  • 480
Loading comments...

More from Ricardo Longa