AyyalAwwad / Espresso-Examples

Helpful Espresso snippets for Android UI testing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Espresso-Examples

A reference project for all of those things you forgot how to do in Espresso!

About

This repository contains an example Android application and a number of helpful Espresso UI tests to act as a helpful reference. The Espresso Package Reference can be found here.

How to use

To use test execute the tests you will can execute using the gradle command: ./gradlew app:createDebugCoverageReport or by building the tests with a test configuration in Android Studio.

Libraries used

  • Android Testing Library

        dependencies {
            androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
        }
  • Espresso 2.0 Core

        dependencies {
            androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'
        }
  • Espresso 2.0 Contrib

        dependencies {
            androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.0'
        }
  • Jacocco Code Coverage

        debug {
            testCoverageEnabled true
        }

Espresso library usage and where to find them

Below is an example of theEspresso methods that have been used so far in the example application.

Matchers

The onView(Matcher<View>) method can accept Matchers to identify a View.

Hamcrest Matchers

Actions

Actions are performed using the perform(ViewAction) method.

Assertions

Assertions are performed using the check(ViewAssertion) method.

Widgets

Below is a short list of the Widgets and Views that are tested in this Repository.

Tested

  • TextView

  • Button

  • EditText

  • Overflow Menu

  • App Drawer

  • ViewPager

To be tested

  • Spinner

  • ProgressBar

  • ViewPager

  • PagerTabStrip

  • Date and Time Widgets

To be demonstrated

  • Idling Resources

JaCoCo Coverage

The JaCoCo Coverage plugin has been included to demonstrate coverage reporting. The Code Coverage can be found in the following directory structure within the module you are testing build/outputs/reports/coverage/debug/index.html

Contact me

+JordanTerry

@Jordan_Terry

About

Helpful Espresso snippets for Android UI testing.


Languages

Language:Java 100.0%