Giter VIP home page Giter VIP logo

device-automator's Introduction

device-automator

Build Status

Device Automator is an Android library built on top of the UI Automator testing framework. Device Automator provides an easy to use syntax for writing UI Automator tests that interact across apps and the device itself. The Device Automator API very closely resembles the Espresso API and similarly encourages test authors to think in terms of what a user might do while interacting with the application - locating UI elements and interacting with them.

Setup

Download device-automator

Add the dependency in your build.gradle file:

dependencies {
  androidTestCompile 'com.lukekorth:device-automator:1.1.0'
}

To use the latest build from the master branch use:

dependencies {
  androidTestCompile 'com.lukekorth:device-automator:1.1.0-SNAPSHOT'
}

Set the instrumentation runner

Add the following line to your build.gradle file in android.defaultConfig:

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Writing Tests

It's recommended that you start every test from your device's home screen. To do that, run the following before each test:

onDevice().onHomeScreen();

To launch an app, call:

onDevice().launchApp("com.myapp.package");

To click on a view:

onDevice(withText("My Button")).perform(click());

To type text:

onDevice(withText("Enter text here")).perform(setText("foobar"));

To make assertions after interacting:

onDevice(withContentDescription("message field")).check(text(containsString("my message")));

device-automator's People

Contributors

braintreeps avatar lkorth avatar sarahkoop avatar sshropshire avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.