Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
res -Espresso Web Basic Sample Jul 25, 2015
src/com/example/android/testing/espresso/basicsamplebundled -Espresso Web Basic Sample Jul 25, 2015
tests/com/example/android/testing/espresso/basicsamplebundled/tests -Espresso Web Basic Sample Jul 25, 2015
.gitignore -Espresso Web Basic Sample Jul 25, 2015
AndroidManifest.xml Bumps build tools, sdk and support lib versions and fixes lint errors Sep 1, 2015 update settings animation description Oct 5, 2015
ic_launcher-web.png -Espresso Web Basic Sample Jul 25, 2015
proguard-project.txt -Espresso Web Basic Sample Jul 25, 2015 -Espresso Web Basic Sample Jul 25, 2015

Basic sample for Espresso using static JAR files

If you are using Espresso with Eclipse, try this sample first.

This project uses Eclipse and ADT to build and run the tests.

  1. Download the project code, preferably using git clone.
  2. Check out the static JAR files required to run the Espresso tests in the libs/ folder of the project
  3. Run the ./ script to remove duplicated LICENSE.txt files. This step is required because some of the test dependencies contain LICENSE.txt files which result in this build error: "Error generating final archive: Found duplicate file for APK: LICENSE.txt". The problem is that the same LICENSE.TXT file is found multiple times and AAPT does not know how to resolve this conflict.
  4. Check out the relevant code:
    • The application under test is located in src/
    • Tests are in tests/
  5. Create the test configuration with a custom runner:
    • Open Run menu | Run Configurations
    • Click on Android JUnit Test
    • Add a new configuration by pressing the "new launch configuration" button
    • Select your project by clicking the "Browse" button
    • Add a Specific instrumentation runner:
  6. Connect a device or start an emulator
    • Turn animations off. (On your device, under Settings->Developer options disable the following 3 settings: "Window animation scale", "Transition animation scale" and "Animator duration scale")
  7. Run the newly created configuration

The application will be started on the device/emulator and a series of actions will be performed automatically.