Skip to content
Branch: master
Find file History
brettchabot Use new androidx.test APIs and general cleanup.
  - Use new AndroidJUnit4, ApplicationProvider, and ActivityScenario
    APIs wherever possible.
  - Set compile/min/target sdk versions to 28,14,28 consistently
  - Define min and target sdk versions in build files not manifest, to
    appease gradle+studio
  - Use constants to define versions in bazel builds
  - Update to guava 26.0-android consistently
Latest commit 7984eaa Oct 12, 2018
Type Name Latest commit message Commit 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 Use new androidx.test APIs and general cleanup. Oct 11, 2018
.gitignore -Espresso Web Basic Sample Jul 25, 2015
AndroidManifest.xml fix bazel build Sep 28, 2018 fix bazel build Sep 28, 2018
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: androidx.test.runner.AndroidJUnitRunner
    • 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: androidx.test.runner.AndroidJUnitRunner
  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.

You can’t perform that action at this time.